Songs are sung primarily in the mating and birthing
season, so the songs probably play some role in determining who will mate
with whom. Very recently the scientific community has begun to entertain
the notion that at least some whale species, including humpbacks, learn
from one another and behave according to cultural norms, not just out of
biological impulses. In that case singing is probably done for complex
cultural reasons, not just for simple biological needs.
Whales have no pinna or ear flap, the outer ear canals apparently are no longer used, and many toothed whales hear via their lower jaw. The terrestrial animal ear bone is a part of the skull itself, but this is not so in whales. This probably reduces the amount of flow noise that the whale would have to hear as it swims.
The inner ear and neural system of whales have adapted to enable them to hear and decode very low or very high frequency sounds, depending upon species. The mysticete whales (also called baleen whales) tend to produce and use very low frequency sound, while odontocetes (also called toothed whales) make use of very high or ultrasonic frequencies for echolocation.
Sound behaves very differently in a water medium than in air. For one thing, sound travels five times faster in water than it does in air. Sound waves also behave differently depending on depth, temperature and salinity, sometimes becoming "trapped" in sound pathways or "ducts".
Scientists have given hearing tests to some cetaceans in captivity, but these tests have usually been run in pools or bays that may not be representative of their natural environment. Therefore, what and how whales hear is still poorly understood. All we know is that whales rely more on the use of sound than perhaps any other animal on Earth. That is why there is growing concern over the amount of noise that mankind is putting into the oceans and the effect it may have on whales.