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.