Lactation describes the secretion of milk from the mammary glands and the period of time that a mother lactates to feed her young. The process naturally occurs with all post-pregnancy female mammals, although it predates mammals. In humans the process of feeding milk is also called breastfeeding or nursing. Newborn infants often produce some milk from their own breast tissue, known colloquially as witch's milk.
In most species, lactation is a sign that the individual has been pregnant at some point in her life, with the exception of humans and goats. Nearly every species of mammal has nipples; except for monotremes, egg-laying mammals, which instead release milk through ducts in the abdomen. In only one species of mammal, the Dayak fruit bat from Southeast Asia, is milk production a normal male function.
Galactopoiesis is the maintenance of milk production. This stage requires prolactin. Oxytocin is critical for the milk let-down reflex in response to suckling. Galactorrhea is milk production unrelated to nursing. It can occur in males and females of many mammal species as result of hormonal imbalances such as hyperprolactinaemia.
The chief function of a lactation is to provide nutrition and immune protection to the young after birth. Due to lactation, the mother-young pair can survive even if food is scarce or too hard for the young to attain, expanding the environmental conditions the species can withstand. The costly investment of energy and resources into milk is outweighed by the benefit to offspring survival.  In almost all mammals, lactation induces a period of infertility (in humans, lactational amenorrhea), which serves to provide the optimal birth spacing for survival of the offspring.
It is also possible to induce lactation without pregnancy. Protocols for inducing lactation are called the Goldfarb protocols. Using birth control pills to mimic the hormone levels of pregnancy, then discontinuing the birth control, followed by use of a double electric breast pump for 15 minute sessions at regular 2-3 hour intervals (100+ minutes total per day) helps to induce milk production.
During the latter part of pregnancy, the woman's breasts enter into the Secretory Differentiation stage. This is when the breasts make colostrum (see below), a thick, sometimes yellowish fluid. At this stage, high levels of progesterone inhibit most milk production. It is not a medical concern if a pregnant woman leaks any colostrum before her baby's birth, nor is it an indication of future milk production.
At birth, prolactin levels remain high, while the delivery of the placenta results in a sudden drop in progesterone, estrogen, and HPL levels. This abrupt withdrawal of progesterone in the presence of high prolactin levels stimulates the copious milk production of Secretory Activation.
When the breast is stimulated, prolactin levels in the blood rise, peak in about 45 minutes, and return to the pre-breastfeeding state about three hours later. The release of prolactin triggers the cells in the alveoli to make milk. Prolactin also transfers to the breast milk. Some research indicates that prolactin in milk is greater at times of higher milk production, and lower when breasts are fuller, and that the highest levels tend to occur between 2 a.m. and 6 a.m.
Other hormones—notably insulin, thyroxine, and cortisol—are also involved, but their roles are not yet well understood. Although biochemical markers indicate that Secretory Activation begins about 30-40 hours after birth, mothers do not typically begin feeling increased breast fullness (the sensation of milk "coming in the breast") until 50-73 hours (2-3 days) after birth.
Colostrum is the first milk a breastfed baby receives. It contains higher amounts of white blood cells and antibodies than mature milk, and is especially high in immunoglobulin A (IgA), which coats the lining of the baby's immature intestines, and helps to prevent pathogens from invading the baby's system. Secretory IgA also helps prevent food allergies. Over the first two weeks after the birth, colostrum production slowly gives way to mature breast milk.
The hormonal endocrine control system drives milk production during pregnancy and the first few days after the birth. When the milk supply is more firmly established, autocrine (or local) control system begins.
During this stage, the more that milk is removed from the breasts, the more the breast will produce milk. Research also suggests that draining the breasts more fully also increases the rate of milk production. Thus the milk supply is strongly influenced by how often the baby feeds and how well it is able to transfer milk from the breast. Low supply can often be traced to:
This is the mechanism by which milk is transported from the breast alveoli to the nipple. Suckling by the baby stimulates the paraventricular nuclei and supraoptic nucleus in the hypothalamus, which signals to the posterior pituitary gland to produce oxytocin. Oxytocin stimulates contraction of the myoepithelial cells surrounding the alveoli, which already hold milk. The increased pressure causes milk to flow through the duct system and be released through the nipple. This response can be conditioned e.g. to the cry of the baby.
Milk ejection is initiated in the mother's breast by the act of suckling by the baby. The milk ejection reflex (also called let-down reflex) is not always consistent, especially at first. Once a woman is conditioned to nursing, let-down can be triggered by a variety of stimuli, including the sound of any baby. Even thinking about breastfeeding can stimulate this reflex, causing unwanted leakage, or both breasts may give out milk when an infant is feeding from one breast. However, this and other problems often settle after two weeks of feeding. Stress or anxiety can cause difficulties with breastfeeding. The release of the hormone oxytocin leads to the milk ejection or let-down reflex. Oxytocin stimulates the muscles surrounding the breast to squeeze out the milk. Breastfeeding mothers describe the sensation differently. Some feel a slight tingling, others feel immense amounts of pressure or slight pain/discomfort, and still others do not feel anything different.
A poor milk ejection reflex can be due to sore or cracked nipples, separation from the infant, a history of breast surgery, or tissue damage from prior breast trauma. If a mother has trouble breastfeeding, different methods of assisting the milk ejection reflex may help. These include feeding in a familiar and comfortable location, massage of the breast or back, or warming the breast with a cloth or shower.
This is the mechanism by which milk is transported from the breast alveoli to the nipple. Suckling by the baby innervates slowly-adapting and rapidly-adapting mechanoreceptors that are densely packed around the areolar region. The electrical impulse follows the spinothalamic tract, which begins by innervation of fourth intercostal nerves. The electrical impulse then ascends the posterolateral tract for one or two vertebral levels and synapses with second-order neurons, called tract cells, in the posterior dorsal horn. The tract cells then decussate via the anterior white commissure to the anterolateral corner and ascend to the supraoptic nucleus and paraventricular nucleus in the hypothalamus, where they synapse with oxytocinergic third-order neurons. The somas of these neurons are located in the hypothalamus, but their axon and axon terminals are located in the infundibulum and pars nervosa of the posterior pituitary, respectively. The oxytocin is produced in the neuron's soma in the supraoptic and paraventricular nuclei, and is then transported down the infundibulum via the hypothalamo-neurohypophyseal tract with the help of the carrier protein, neurophysin I, to the pars nervosa of the posterior pituitary, and then stored in Herring bodies, where they are stored until the synapse between second- and third-order neurons.
Following the electrical impulse, oxytocin is released into the bloodstream. Through the bloodstream, oxytocin makes its way to myoepithelial cells, which lie between the extracellular matrix and luminal epithelial cells that also make up the alveoli in breast tissue. When oxytocin binds to the myoepithelial cells, the cells contract. The increased intra-aveolar pressure forces milk into the lactiferous sinuses, into the lactiferous ducts (a study found that lactiferous sinuses may not exist. If this is true then milk simply enters the lactiferous ducts), and then out the nipple.
A surge of oxytocin also causes the uterus to contract. During breastfeeding, mothers may feel these contractions as afterpains. These may range from period-like cramps to strong labour-like contractions and can be more severe with second and subsequent babies. 
In humans, induced lactation and relactation have been observed frequently in some cultures, and demonstrated with varying success in adoptive mothers. It appears plausible that the possibility of lactation in women (or females of other species) who are not biological mothers does confer an evolutionary advantage, especially in groups with high maternal mortality and tight social bonds. The phenomenon has been also observed in most primates, in some lemurs, and in dwarf mongooses.
Lactation can be induced in humans by a combination of physical and psychological stimulation, by drugs, or by a combination of those methods. Some couples may stimulate lactation outside of pregnancy for sexual purposes.
Rare accounts of male lactation (as distinct from galactorrhea) exist in historical medical and anthropological literature, although the phenomenon has not been confirmed by more recent literature.
Charles Darwin recognized that mammary glands seemed to have developed specifically from cutaneous glands, and hypothesized that they evolved from glands in brood pouches of fish, where they would provide nourishment for eggs. The latter aspect of his hypothesis has not been confirmed; however, more recently the same mechanism has been postulated for early synapsids.
As all mammals lactate, lactation must have evolved before the last common ancestor of all mammals, which places it at a minimum in the Middle or Late Triassic when monotremes diverged from therians. O. T. Oftedal has argued that therapsids evolved a proto-lacteal fluid in order to keep eggs moist, an adaption necessitated due to diapsids parchment shelled eggs which are more vulnerable to evaporation and dehydration than the mineralized eggs produced by some sauropsids. This protolacteal fluid became a complex, nutrient-rich milk which then allowed a decline in egg size by reducing the dependence on a large yolk in the egg. The evolution of lactation is also believed to have resulted in the more complex dentition seen in mammals, as lactation would have allowed the prolonged development of the jaw before the eruption of teeth.
During early evolution of lactation, the secretion of milk was through pilosebaceous glands on mammary patches, analogous to the areola, and hairs on this patch transported the nourishing fluids to the hatchlings as is seen in monotremes. The development of the nipple occurred in the mammal lineages that diverged after monotremes, metatheria and eutheria.
Another well known example of nourishing young with secretions of glands is the crop milk of columbiform birds. Like in mammals, this also appears to be directed by prolactin. Other birds such as flamingos and penguins utilize similar feeding techniques.
The discus fish (Symphysodon) is known for (biparentally) feeding their offspring by epidermal mucus secretion. A closer examination reveals that, as in mammals and birds, the secretion of this nourishing fluid may be controlled by prolactin. Similar behavior is seen in at least 30 species of cichlids.
Lactation is also the hallmark of adenotrophic viviparity - a breeding mechanism developed by some insects, most notably tsetse flies. The single egg of the tsetse develops into a larva inside the uterus where it is fed by a milky substance secreted by a milk gland inside the uterus. The cockroach species Diploptera punctata is also known to feed their offspring by milky secretions.
Toxeus magnus, an ant-mimicking jumping spider species of Southeast Asia, also lactates. It nurses its offspring for about 38 days, although they are able to forage on their own after 21 days. Blocking nursing immediately after birth resulted in complete mortality of the offspring, whereas blocking it 20 days after birth resulted in increased foraging and reduced survival. This form of lactation may have evolved from production of trophic eggs.