Only mammals have mammaries and mammary glands.
What evolutionary factors determines the number of mammaries (nipples/teats/breasts) a species has?
Is it always an even number?
The number of mammary glands a species has is related to litter size. The relationship generally follows the "one-half rule," which states that the average litter size is equal to half the number of mammaries. The number of mammaries also tends to put an upper limit on litter size. It's not necessarily a hard limit, but survival tends to drop noticeably when number of offspring being nursed exceeds number of mammaries.
The number of mammaries is almost always even, but a notable exception is the Virginia possum, which has thirteen.
Gilbert, A.N. 1986. Mammary number and litter size in Rodentia: The "one-half rule". Proc. Natl. Acad. Sci. USA. Vol. 83, pp. 4828-4830.
As an addition to the excellent post by Erin.
As a name-giving key feature,mammals have mammary glands.
Some have seen this iconic picture, showing the bilateral symmetry in chordates:
It is easy to see why most commonly even number of mammary glands are found in mammals, given that they form in pairs, distal from the notochord.
Evolutionary, an uneven number of mammaries may be explained through a subjectively-mild mutation which may be retained as a vestigial-like feature, somewhat-functional or not.
On a molecular level, unilateral mammary glands likely involve key developmental pathways such as hedgehog and likely has underlying polygeneic root causes, - for the termination of gland formation on one side.
See this intersting paper:
It is noteworthy that the mammary glands in the male human population didn't decrease fitness to such a degree where evolutionary pressure would have lead to cease gland formation altogether, by adding extra information to the sex-chromosome(s). As such human males retain mammary glands, albeit typically never reaching a functional state.
The factors weighting against such additional genes are, that the default formation in most mammals is the female body plan, which conserves functional mammary glands to potentially feed their offspring, chipping away at the chance of genes involved in the cessation of mammary gland formation.
Concluding, naturally, it would be easy for an asymmetric sponge to have an uneven number of protrusions or orifices, less so for humans, unless the orifice is located along an axis of symmetry.
Ad biological symmetry: