A light broke in upon my brain
It was the carol of a bird.
-Byron, The Prisoner of Chillon
You can't be outside very long -- in the warmer months, at least -- without hearing the sound of birds singing from their trees. While it may sound wonderfully melodious to you, to other birds the songs are rich with meaningful communication. Birds sing primarily for two reasons: to defend their territory, and to attract a mate. Hence, most birds have at least two songs, though some (nightingales, for instance) know hundreds of different songs. These activities are both primarily the male's responsibility, so male birds tend to have clearer voices and better defined songs.
Winning and defending territory must be done before the male bird has any hope of finding a mate. These often short and simple songs act to communicate with other males that the area where the song is loudest belongs to the bird that is singing. Spaces between songs allow the the singer to listen for other males and judge their distance. Most rival birds will not try to stay in an area where another bird is already singing loudly, and will leave without conflict. More confident avians may stay where they have landed, forcing the defender make display flights to show that he is aware of the transgression, and possibly even a physical attack on the aggressive bird. Along with the defensive actions, the defender also sings more loudly and possibly with different songs, so the aggressor receives visual and audible warnings.
Once a bird has successfully taken an area for himself, he can begin trying to attract mates. This requires a completely separate song, often longer and more complex, sometimes with parts in different orders. Theory states that many species sing mating songs at dawn because that's when their energy stores are lowest, so singing at that time is much more impressive to females; though dawn also has the best air conditions for sound travel. Females often spend several days listening to different males' songs before making a decision, and birds often mate for life. After the female has been attracted and eggs are laid, the male goes back to singing mostly the defense song to keep others away from their nest.
Instead of producing sound with a larynx in their throat, as a mammal would, birds have a special organ named the syrinx that produces song. Located where the bronchi of each lung join to form the main air passageway. Each side has a flap of skin which acts in much the same way as a clarinet reed, and the stiffness of each can be controlled independently. Thus birds have control over two sources of sound, which mix and resonate in the area just past the syrinx. The timbre of the syrinx's sound is mediated by the pressure put out by the lungs, and can go from soft non-vocal breathing to a nearly perfect sine wave to a "noisy," harmonic-laden tone.
Recent research based on the canary syrinx has shown that even complex bird songs are made up relatively simple variations in the physical system. Mixing and resonance are already built into the system, so the bird really only has control over the stiffness of the vocal folds and the pressure produced by their lungs. By modeling this as a differential equation, the researchers were able to recreate all canary songs with simple control statements. High pressure + High stiffness, Low pressure + High stiffness, Low pressure + Low stiffness, for instance, would create a three step downward scale of harmonious song. While singing a song in this manner may require deep thought by the bird, it has nowhere near the control complexity of, say, a human's mouth.