Most mammalian males have nipples. The duck-billed platypus does not have nipples but you begin to see development of nipples in marsupials (Park and Lindberg 2004) like the opossum and kangaroo. Development of a complete nipple begins in the eutherian (placental) mammals.
The mammary glands develop early in the embryo along a pair of ridges called the mammary ridge, mammary lines, or milk line (shown in an adult human in the figure below, taken from Wikipedia). The nipples form along this line. In humans, this happens during the fifth week of development. Within a few days, nipples begin to form. The number of nipples pairs that form is characteristic of the species (e.g., 1 pair in humans to 9 pairs in pigs). The development of nipples occurs before sexual differentiation begins which, in humans, is during the sixth week of development. That's why both males and females have nipples. This same order of develop occurs in other mammals, revealing our common ancestry.
However, because the process is under genetic control, mistakes can happen. Occasionally, humans (and other mammals) can develop extra nipples, the so-called supernumerary nipple(s). The most common places that humans develop one or more supernumerary nipples are identified by the circles in the figure above. The actor Mark Wahlberg is not shy about showing his.
For a general overview of mammary gland development, Dr. Jacqueline Veltmaat has a nice web page that highlights her research in this area. For those interested in the more technical genetic aspects of mammary gland development, a paper by Watson and Khaled (2007) reviews the genetic processes that regulate development of the mammary gland in mammals, based on the mouse model system. The article covers all stages of mammary gland development, from the embryo through puberty to pregnancy. Their Figure 1 shows one row of embryonic mammary buds (labeled MB1 - MB5) in the embryonic mouse. In the case of the mouse, all of the mammary buds will develop into fully functioning mammary glands. Another paper by Robinson (2007) discusses the signalling pathways during development of the mammary glands.
Park, C.S. and G.L. Lindberg. 2004. The mammary gland and lactation. pp. 720-741 in Dukes' Physiology of Domestic Animals, W.O. Reece, ed. (Publisher not identified.)
Robinson, G.W. 2007. Cooperation of signalling pathways in embryonic mammary gland development. Nature Reviews Genetics 8: 963-972.
Watson, C.J. and W.T. Khaled. 2008. Mammary development in the embryo and adult: a journey of morphogenesis and commitment. Development 135: 995-1003.