Dolphins are not fish, they breathe through lungs not through gills as fish do. They can’t stay underwater forever they must come to the surface to breathe. If they can’t, they will drown just like humans do. So, in order to breathe, they have to be conscious.
Then how do dolphins breathe?
They breathe through the blowhole, a hole in the top of their head. The blowhole can empty and refill the lung in less than one second through an explosive blow that can reach high velocities: up to 100 miles per hour, which sometimes makes a nice spring well J. Really you do not want to be near them when they breath J.
The blowhole has a lot of nerves around that sense pressure changes so the animal knows when its blowhole is clear of the water and it is safe to breathe.
They can’t hold their breath for long: as long as 15-30 minutes. This is anyways much longer than humans, who can hold their breath for 1-2 minutes with a lot of training. Because of that, usually they don’t stay down longer than half a minute or so. Though, it is enough time to exchange over 70% of the air in their lungs.
We do understand now that dolphins are conscious breathers: they actively decide when to come to the surface to breath. This make sleeping very difficult, as what happens if the dolphins fall asleep?
Learn more about how dolphins sleep.