We all carry two copies of each gene (outside of male sex chromosomes). If the two differ from each other often one is dominant and one recessive. How does this mechanism work on a molecular level? What mechanism determines which gene gets expressed?
Generally if one of the genes' biochemical functions becomes knocked out completely, the other copy will fill in for it, making the trait recessive - requiring both copies being knocked out.
An example of such a recessive trait is Albinism - if both copies of the enzyme participating in melanin biosynthesis are ineffective, the result is someone with no pigment.
Dominant genes are often variant genes which convey a new ability (phenotype) and as such the trait can show up with just one copy has this variant. Phenylthiocarbamide tasting is an example of this dominance. If both copies of the gene were the variant, the original ability might disappear - making the original trait dominant as well.
There are other sorts of dominance. If a variant shows up that inhibits a the other copy this can cause dominance by a variant; it can remove or modulate a phenotype (trait) by turning off or turning down the other copy of the gene. This would be a case of trans-dominance.
I'm sure there are many other variants on these themes others could post. Dominance and recessivity are relative and broad terms when you see how traits are inherited.
On the molecular level, genes most often encode proteins which perform some function for the cell: For example, they could be enzymes and catalyze chemical reactions. They could also have some structural function, such as make up the "muscle" part of your muscle cells... You get the idea.
In the most simple case, the dominant allele encodes a protein that can perform its function. For example, the dominant allele for the CFTR gene encodes a channel that can let chloride into and out of the cells. The recessive allele, on the other hand encodes a protein that cannot do its job correctly (this also called a loss-of-function mutation). So if you inherit a functional copy from one parent and a non-functional copy from the other parent, you will still have one copy of the protein that can do its job. Only if you get a nonfunctional copy from both parents will you have a recessive condition called cystic fybrosis.
On the molecular level a gene can also encode a dominant-negative variant of a protein. In this case the protein cannot do its job and also prevents the functional version of the protein to do its job too.
A third way this could work is by a gain-of-function mutation. In this case, the gene encoding a protein acquires a mutation that gives a new function to the protein. For example, in Huntington's disease, the mutant Huntingtin protein acquires the ability to clump together in large plaques, which are poisonous to some neurons in the brain. Since it takes only one copy of the protein to perform the new function, the gain-of-function allele is a dominant one.
These are only a few examples that deal with simple dominant and recessive inheritance. Most often there are more complex mechanisms of inheritance at play.