Alleles refer to duplicate genes, where one allele can be dominant over the other. What makes an allele dominant or recessive, given that both code for a single protein?.
There are several hypotheses about the evolution of dominance. It is important first of all, to note that empirical observations show that beneficial alleles tend to be more dominant than detrimental alleles. Among the two main hypotheses to explain the evolution of dominance, one has been formulated by Ronald Fisher and one by Sewall Wright.
According to Fisher's hypothesis, between two equally beneficial alleles, if one is more dominant than the other than it's heterozygote carrier will have higher fitness. In consequence, beneficial alleles evolve to become more dominant while detrimental alleles evolve to be recessive (so that they can hide from selection in heterozygotes).
According to Wright's hypothesis, beneficial alleles are more dominant because of the kinetic of biochemical reactions. The rate of a biochemical reaction is a function of the concentration in the substrates of interest. The function is called "Michaelis-Menten function" after the name of the authors. The Michaelis-Menten function looks like this:
Think about a knock-out mutation. Such mutation will decrease by half the concentration of protein the gene in question produce in heterozygotes. Imagine, the concentration of proteins in the wildtype homozygote was 3 (see above graph). The rate of reaction of this homozygote is therefore about 3. The heterozygote would have a concentration of 1.5 and the rate of the reaction is therefore about 2.5-2.75. Assuming that the rate of this biochemical reaction is directly related to fitness, then a the locus of interest, benefical alleles are necessarily dominant and detrimental alleles are necessarily recessive. Selection for dominance is not involved in Wirght's model.
Is Fisher's or Wright's hypothesis correct?
Current state of the art is to consider Wright's model to be correct and Fisher's model to be wrong. In reality, the truth probably lies somewhere in between these two extremes. Note also that some other alternative explanations may exist in the literature but Wright and Fisher original hypotheses are by far the most considered hypotheses for the evolution of dominance. During my undergrad, I remember a speaker (but I forgot his name, sorry!) who showed that some alleles actually have some domain that are directly responsible for decreasing the expression of the other allele on the sister chromosome suggesting that Fisher's hypothesis might sometime be a good explanation as well.