Why do whales have blowholes?

Whales are mammals who breathe air into their lungs. Blowholes are basically a whale's nostrils, and are located on the top, or back of the whale's head.

They are covered by muscular flaps that keep water from entering them when the whale is under water, and in the relaxed state, the flap covers the blowhole.

A blowhole leads to the whale's trachea and then to its lungs. Unlike us, whales cannot breathe through their mouth; they only breathe through their blowholes. 

At the surface of the water, whales open their blowhole(s) and exhale air explosively through their blowhole. 

This exhaled air from the blowhole is called the 'blow,' and usually forms a gusher or a bushy stream of misty air and vapour. 

This is then immediately followed by inhalation of fresh air, and the blowhole(s) close again. 

This breathing pattern takes only a fraction of a second for small cetaceans (dolphins and porpoises), but it may take a few seconds for larger whales.

So, why do some whales have one blowhole and some have two?

Most mammals have two nostrils (blowhole equivalents). 

One of the nostrils of toothed whales evolved into their echolocation system (the sensing system in which they make, and receive high-pitched sounds in order to orient themselves, catch prey, and communicate), leaving them with only one blowhole.