While we do know that the human body is regulated by a circadian clock that keeps humans on a sleep/wake cycle, we don’t really know why. Sleep is the time when our bodies repair tissues and perform other maintenance activities, and we spend nearly a third of our lives snoozing. Some other organisms don’t need to sleep at all, so why do we?
We don't actually know. But these two theories are strong candidates:
Sleep 'cleans' the brain of toxins. Metabolic waste products of neural activity are cleared out of the sleeping brain at a faster rate than during the awake state. This finding suggests a mechanistic explanation for how sleep serves a restorative function, in addition to its well-described effects on memory consolidation.
Sleep helps the organism alternate between day and night. Circadian rhythms enable an organism to anticipate, rather than passively adjust to, the changes imposed by alternation between day and night. These changes relate to positive functions such as vision and negative effects such as ultraviolet light damage. They also include indirectly generated alternations such as temperature, availability of food and prevalence of predators.
In regards to animals that don't sleep, the affirmation is half valid. Arthropods don't sleep, but enter a metabolic slowdown state. Dolphins put half their brains to sleep while the other half stays active. Basically, anything with a brain needs to sleep, in some way or the other.
Homeostatic regulation is an interesting clue, because it suggests that there are some conserved functions of sleep. The need to make up lost sleep must be there for a reason.
If sleeping didn't have a necessary function, it wouldn't be universal. And it most definitely has to do with the brain, because it is the organ affected the most by lack of it.
There are several theories for the function of sleep (with a focus on the brain) with varying amounts of evidence (mostly through sleep deprivation's interference of these processes)...
- Energy savings.
- A time to open up spaces between brain cells to flush out metabolites and toxins including beta amyloid.
- Memory consolidation - move labile new memories into longer term storage.
- Create more brain space - reduce "synaptic load" gained during the previous day's experience, so you are better able to make new memories the next day.
- Creativity - make abstract links and problem solving.
- Emotional/mood recalibration.
Why it's thought these occur in the sleep state is that it provides the right neurochemical milieu to perform these necessary tasks, which would be inefficient or even dangerous if it occurred during your conscious experience.