Why do we sleep?Paul King:A number of proposals and perspectives have emerged that, taken together, paint a compelling and converging picture for why sleep evolved and why it is now needed.
WHY SLEEP EVOLVED
The earliest differentiation into day versus night behavior in animals was probably driven by differences in temperature and the light available for vision. Day and night are further differentiated by the aggregate "behavior" of the ecosystem (other animals also have day/night cycles). As a result, the optimal day and night survival strategies are different, and animals would have adapted to synchronize their survival strategy to the 24-hour cycle.
Evidence is accumulating that complex nervous systems, and especially the brain, perform and benefit from internal maintenance activities. Some of these maintenance activities, such as "synaptic network stabilization," occur at the cellular level. Others, such as memory consolidation or the proposed memory transfer between brain areas, occur at the whole brain level.
The brain's internal maintenance disrupts optimal behavioral responsiveness. An animal can't be fully vigilant for predators while its brain is doing internal housekeeping. For example, memory consolidation requires information unrelated to the present moment to be accurately moved around the brain under the management of organized processes. Certainly the groggy state upon waking up is not optimal for fending off an attacker. For this reason, there is evolutionary pressure for the animal to postpone internal maintenance activities while engaging with the external environment (finding food, mates, etc.) so as to reduce risk of harm.
These postponed maintenance activities have to happen sometime. To optimize survival, the organism schedules a time for them when it will be safest, which includes finding a protected place to be and initiating all maintenance activities in parallel to get them out of the way. This leads to the temporal synchronization of all postponed maintenance activities.
Collectively, these four environmental and biological pressures lead to a bifurcation of external interactive behavior and internal maintenance activity that is synchronized with the 24-hour day/night cycle. They further encourage all postponed internal maintenance activities to be synchronized and performed in parallel—in other words, sleep.
Given the different day versus night ecosystems, it is natural that animals that have a survival edge during one phase of the 24-hour cycle would use the other phase for sleeping. "Diurnal" animals are specialized for engaging with the daytime environment, whereas "nocturnal" animals (cats, kangaroos, and owls, for example) are specialized for night and sleep during the day. However there are other patterns as well, such as "crepuscular" animals that are active at the day/night boundary (dawn or dusk).
WHY SLEEP IS NOW NEEDED
Given that a regular sleep period has formed, the question is: What goes on during sleep that is so important?
There appears to be no one single sleep activity that is the reason for sleep. Because the sleep/wake division of the 24-hour activity cycle has been around in animals for a long time—all known animals have a quiescent period—the sleep period has had hundreds of millions of years to acquire multiple uses.
At the cellular level, removing toxic radicals and strengthening or rebuilding tissues has been suggested.
In the brain, a number of uses for sleep have been identified or proposed , including:
- Restoring neurons biochemically
- Rescaling the connection strengths of synapses in the brain's neural networks to facilitate easier learning the next day. This might include rewiring activity (growing synapses).
- Consolidating (reorganizing and restructuring) memories. 
- Transferring memories from the memory-specialized fast-learning brain area (the hippocampus) to the higher-capacity more cognitively powerful area (the cerebral cortex). 
"At the whole animal behavioral level, the functions of sleep seem clear: energy is saved, performance is restored, and (in humans) affect becomes more positive. Such findings have led to the universal acknowledgement that sleep restores brain function." 
SLEEP AS A DIVERSE AND DECENTRALIZED PHENOMENON
A wide variety in sleep patterns can be found across animal species. Some animals (insects, fish) are quiescent but not fully "asleep" (inactive). In cetaceans (whales and dolphins), half of the brain goes to sleep at a time for one to two hours on an irregular schedule throughout the day and night. Bears, bats, and some rodents hibernate, which is a quiescent extended-sleep period lasting for weeks or months in the winter. Siegel (2008) reviews the phenomenon of sleep across animal species. 
Krueger et al (2008) reviews the functions and mechanisms of sleep in the brain and proposes that sleep is not a centralized process of the brain, as is normally thought, but is instead a decentralized intrinsic process of neural tissue. They propose that neural tissue initiates sleep onset in a decentralized fashion that propagates until it takes over the whole brain, in something like a social mass movement. The evolutionary pressure to partition activity into day/night divisions is also discussed. 
This chart shows the evolution of sleep in relation to the environment, metabolism, and the development of complex nervous systems. "R-A cycles" = Rest-Activity cycles. Sleep appears in the bottom two frames.
from Krueger et al (2008) 
This post originally appeared on Quora. Click here to view.