To answer the question regarding whether or not whales sleep (which is often asked due to the fact that whales live in water) we first need to explain what affects a whales ability to sleep when compared to land animals such as humans.
Whales like humans are mammals and share many of the same physiological traits including the need to breathe air, however one major difference between humans and whales involves the difference in what affects a human or land animals ability to breathe and what affects a whales ability to breathe and this primary difference is the fact that humans live on land while whales live in the ocean.
In fact this one difference has a major impact on both the sleeping and breathing habits of whales and humans.
Because we live on land most of the time humans do not have to be conscious or in complete control of their breathing; in fact breathing comes naturally to us whether or not we are aware of the fact that we are always breathing.
Unlike whales we do not have to consistently fear drowning or worry about coming up for air when we go to sleep and we usually only become aware of our breathing when we are swimming or running to exhaustion.
Whales do not have this luxury and unlike fish whales do not have gills which fish use to extract oxygen from the water, so they must come to the surface get their oxygen.
This consistent need to be aware of their oxygen requirements causes whales to always be conscious of their breathing because if they were able to ignore their need to surface they would drown.
In order to help whales survive in the ocean these marine mammals have specialized lungs that allow them to extract more oxygen from the air than humans and other land animals which helps them transfer blood to vital organs and hold their breath significantly longer than most animals.
In fact some researchers believe that a whale can use up to 90% of their air the inhale while humans can only use around 15% of the air they inhale.
In addition to this whales also have the ability to consistently monitor their oxygen level and shut down non vital components in order to maximize their blood flow and are extremely efficient swimmers so they can minimize the amount of energy they use in order to stay submerged underwater for longer periods of time.
Depending on the species whales are able to hold their breath anywhere from 5 minutes to over an hour, but are limited in how long they can stay submerged before they run out of oxygen or drown; therefore whales are considered conscious breathers.
That means that whales are always aware of their breathing and need for oxygen.
How does this affect sleep?
Because whales are in a constant state of awareness scientists believe that whales are never able to fall completely asleep.
Studies using electroencephalography on dolphins have shown that half of a dolphins brain does indeed shut down when resting, just as a humans does when they fall asleep.
The other half of the brain however remains active allowing the dolphin to remain semi conscious of its breathing so that it does not drown.
While it may be possible for whales to rest almost anywhere it is likely that whales will be found at or near the surface of the water either still or barely moving during this semi resting state so that they may easily replenish their oxygen when necessary.
You can imagine how a whale would be affected if it fell asleep the same way a human does.
If a human were to fall asleep in the water he or she would likely sink and drown because the body is not adapted to this type of lifestyle and would have trouble responding to this type of emergency on a regular daily basis.
At the very least we would wake up in a panic flailing to swim in the right direction and startled by any predator that tried to attack us.
Eventually we would end up tiring ourselves out from constantly swimming and/or panicking which would cause us to use up our oxygen much faster, plus our thin layer of fat compared to the thick layer of blubber whales possess would do very little to protect us from the cold/freezing waters that surround us.
This is why it is so important that whales always remain conscious and alert as their need for oxygen greatly affects their ability to sleep.
Aside from having this level of control over their breathing whales are also fairly buoyant making it easy for them to stay upright and near the surface when at rest so that it is easy to replenish their oxygen supply.
This ability to remain buoyant and float also makes it easier for whales to rest in the water when compared to humans, polar bears and other animals that consistently use their energy to remain surfaced above the water.
All of these factors work together in order to provide whales with an easy and seamless way to stay alert, react to predators and threats and remain prepared, even when resting.
In conclusion whales do rest, however they do not fall asleep the way humans and other animals do because they must remain conscious of their need for oxygen as they live in the ocean.
When they rest they remain partially conscious so that they can react to danger and obtain more air when necessary and their body is designed to allow them to hold their breath for extended periods of time while minimizing the amount of energy they use when swimming.
Their body also allows them to remain buoyant when at or near the surface of the water so that they can rest without using any energy to stay afloat.