Most language learners are curious about this question: In a tonal language, what happens when you sing? Well, depends on the language.
For Mandarin Chinese, especially modern pop music, the melody usually takes over and the four lexical tones are ignored. Native Mandarin speakers will still be able to understand the meaning of the song by the pronunciation of the words even without the tonal information. Only very occasionally, will words in the lyrics cause confusions.
As tonal languages go, Mandarin is by no means the most complicated. The Hmong language, spoken in China, Vietnam, Laos, and Thailand, can have seven or even eight tones. Composing songs in such languages can be a bit challenging. Song writers usually need to take the lexical tones into consideration when they come up with the overall melody. For instance, in Cantonese, if there is a transition from a higher note to a lower one, song writers will need to fill in a syllable with a high tone and then a lower tone, otherwise it would sound odd or hard for people to understand the lyrics.
In some cases, the melody cannot be changed. For example when translating gospel music, the choice of target language words will be greatly limited in order to make sure their lexical tones go along with the melody while these words still express the matching meaning. So if you think about it, tonal language lyricists really are geniuses. Imagine that you are to fill in the lyrics for a song, and your composer friend decided the first vowels of word for you.