Scientists have documented that it seems to only be male humpback whales who sing structured songs, but do we know what purpose their songs play?
There are four hypotheses with varying levels of supporting evidence for why humpback whales sing.
Yes, only males have been shown to sing. It used to be thought that the songs only occurred on breeding grounds and therefore served a reproductive purpose. However, songs have since been recorded on migration routes and feeding grounds, though not as prolifically.
The hypotheses are:
"Mate Attraction" whereby males sing and females approach them to mate. No evidence has ever shown a female humpback whale approach a singing male. Rather, a group of males will swim after a female, vying for position, until she is receptive to mating. Then the closest whale (the primary escort) will be best poised for success. In my opinion, this is the least plausible hypothesis.
"Lekking" whereby a group of males sing to stimulate the females to begin estrus and advertise their body size and health for female mate choice. https://en.wikipedia.org/wiki/Lek_mating This may allow for female selection of choosing a mate later while being pursued as part of competitive group. I am unaware of which articles support this hypothesis and provide evidence. Birds and land mammals are much easier to observe in a lekking behavior than any underwater animal is.
"Territory establishment" whereby males sing to mark their territorial bubble of water. If a male has a larger territory, then it is more likely a female will pass through that larger territory so that the male can respond by pursing her. This could be supported by proving that male humpback whales respect each other's territories and space themselves consistently across their watery world. Refer to http://dx.doi.org/10.1121/1.4962217
"Orientation by echolocation" has recently been put forward by Edward Mercado that song reflects on a broad scale around the whale's environment to provide feedback for navigating the general area. Many researchers argue the plausibility of such low frequencies echoing effectively.
New studies into cultural transmission of parts of songs across ocean basins may suggest the song is not just for reproduction but to fulfill wider communication needs or generate a form of social creativity. See work by Ellen Garland.
Mainly done by male whales during mating season, the songs serve to attract females (possible flirt with them), escort them from place to place and as a means of definining territory to other competing male whales.