Nesting behavior refers to an instinct in animals during reproduction to prepare a place with optimal conditions for offspring. The nesting place provides protection against predators and competitors that mean to exploit or kill offspring. It also provides protection against the physical environment. 

Nest building is important in family structure and is therefore influenced by different mating behaviours and social settings. It is found in a variety of animals such as birds, fish, mammals, amphibians, and reptiles.

In mammals
Female dogs may show signs of nesting behaviour about one week before they are due that include pacing and building a nest with items from around the house such as blankets, clothing, and stuffed animals.  (They also sometimes do this in cases of false pregnancy, or pseudocyesis). Domestic cats often make nests by bringing straw, cloth scraps, and other soft materials to a selected nook or box; they particularly are attracted to haylofts as nest sites. Commercial whelping and queening boxes are available however, children's wading pools (dogs) and plastic dishpans (cats) work just as well. In birds it is known as "going broody", and is characterized by the insistence to stay on the nest as much as possible, and by cessation of laying new eggs. Marsupials do not exhibit a nesting instinct per se, because the mother's pouch fulfills the function of housing the newborns. Nest building is performed in order to provide sufficient shelter and comfort to the arriving offspring. Threats, such as predators, that decrease the chance of survival will increase care of offspring.

Pigs 
Under natural conditions, sows will leave the herd and travel up to 6.5 km a day prior to parturition in order to find the appropriate spot for a nest. The sows will use their forelimbs and snouts in order to create excavated depressions within the ground and to gather/transport nesting materials. Although the nests vary in radius dependent on the age of the sow, the nests are generally a round to oval shape and are usually located near trees, uprooted stumps or logs. The shelter provided by the nest built in sows is of utmost importance to thermoregulation. For the first two weeks of the piglets life their physiological thermoregulation is still developing, and due to a lack of amount of brown fat tissue, piglets require an increased surrounding temperature. Without the protection of the nest, the piglets will be subjected to climatic influences causing their internal temperature to drop to life-threatening levels.

Farrowing crates have been widely implemented into modern pig husbandry in order to reduce piglet mortality via crushing. However, this type of housing disturbs the sows natural instinct to nest build due to lack of space. Thus, it is necessary for the sows to farrow without the performance of this natural pre-partum activity which results in high stress for the animal.

Rodents 

In rodents and lagomorphs, the nesting instinct is typically characterized by the urge to seek the lowest sheltered spot available; this is where these mammals give birth. Rats, for example, prefer to burrow amongst dense areas of vegetation or around human settlements which they come into contact with often. Often some rodent species create burrows that develop microclimates. This is another way that nesting instinct aids in thermoregulation. Alzheimer's disease in rats has been observed to impair the nesting ability, especially in females. These impairments become exaggerated with age and progression of disease.

Particularly among burrowing animals, such as groundhogs and prairie dogs nesting is used all across the burrows for uses such as insulation, bedding, litter chambers, transportation, comfort and various other uses. Marmot species such as groundhogs, and alpine marmots nest their borrows with thick grasses in advance of winter, this keeps a thermoregulated insulated comfortable environment for the marmots as they undergo hibernation.

Hormones and nesting behavior
Maternal nest-building is regulated by the hormonal actions of estradiol, progesterone, and prolactin. Given the importance of shelter to offspring survival and reproductive success, it is no wonder that a set of common hormonal signals has evolved. However, the exact timing and features of nest building vary among species, depending on endocrine and external factors.

The initial drive to perform this behavior is stimulated internally via hormones, specifically a rise in prolactin levels. This increase is driven by an increase in prostaglandin and a decrease in progesterone. The second phase of nest building is driven by external stimuli, this phase is also known as the material-oriented phase. In this stage it is said that external stimuli such as the proper nest building materials must be present. Both internal and external stimuli must exist in conjunction with one another for nest building to commence. The cessation of the nest building is correlated with a rise in oxytocin which is the hormone responsible for the contraction of the uterus. Shortly after this, parturition will commence.

In rabbits, nest building occurs towards the last third of pregnancy. The mother digs and builds a nest of straw and grass, which she lines with hair plucked from her body. This sequential motor pattern is produced by changes in estradiol, progesterone, and prolactin levels. Six to eight days pre-partum, high levels of estradiol and progesterone lead to a peak in digging behavior. Both estradiol and progesterone are produced and released by the ovaries. One to three days pre-partum, straw-carrying behavior is expressed as a function of decreasing progesterone levels, maintenance of high estradiol levels, and increasing prolactin levels. This release of prolactin (from the anterior pituitary) is likely caused by the increase in estrogen-to-progesterone ratio. One day pre-partum to four days post-partum, hair loosening and plucking occur as a result of low progesterone and high prolactin levels, together with a decrease in testosterone. In house mice and golden hamsters, nest-building takes place earlier, at the start or middle of pregnancy. For these species, nest-building coincides with high levels of estrogen and progestin.

External factors also interact with hormones to influence maternal nest-building behavior. Pregnant rabbits that have been shaved will line their straw nest with available alternatives, such as male rabbit hair or synthetic hair. If given both straw and hair, mothers prefer straw during the straw-carrying period, and prefer hair during the nest-lining period. If given hair as the only material, shaved mothers collect the hair even when it is the straw-carrying period.

In birds 
Research on avian paternal behavior shows that nest-building is triggered by different stimuli in the two sexes. Unlike the case for females, male nest-building among ring doves depends on the behavior of the prospective mate rather than on hormonal mechanisms. Males that are castrated and injected daily with testosterone either court females or build nests, depending purely on the behavior of the female. Hence, the male avian transition from courtship to nest-building is prompted by social cues and not by changes in hormone levels.

In fish
In sand goby (Pomatoschistus minutus) the males are the ones who build the nests. When males exhibit increased paternal care to eggs, they build nests with smaller entrances in comparison to males who provide less parental care. This helps prevent predators from entering the nest and consuming the offspring or developing eggs.

In insects

Nesting behavior is also present in many invertebrates. The best known example of nesting behavior in insects is that of the domestic honey bee. Most bees build nests. Solitary bees, like honey bees, make nests. However, solitary bees make individual nests for larvae and are not always in colonies. Solitary bees will burrow into the ground, dead wood and plants.

See also
Genetic memory
Broodiness
Parental brain

References

Human pregnancy
Zoology