How do we "read" a song as one kind of emotion or another? It's a question that music theorists have spend a lot of time debating. There are structural aspects to music, they believe, that read in different ways to our emotional understanding, whether from learned evolutionary responses or something else.
The parts of music that "talk" emotion run the gamut, and are referred to as musical codes. In The Aesthetic Mind, theorists William Forde Thompson and Lena Quinto famously outlined a vast bunch of codes, all talking to us on an emotional level. Structurally, there's dissonance, loudness, how far or close they are from the tonal center, and how much they keep to their structure. Tempo is another: when we hear slow-tempo music we tend to think it's serene, calm or pensive, while fast-tempo music is joyful or restless. Pitch also contributes, and that's before we get into how these different aspects change and shift, reflecting shifts in how we "read" them. (A fast song that slows, for instance, means a change in mood.) There's an awful lot to music beyond just the lyrics.
It's one thing to read an emotion in a song, though. It's quite another to actually feel it. And there are various theories about how that might work. One, most prominently argued by the thinker Stephen Davies, is the idea of "emotional contagion," where we "mirror" what we think we get from music rather in the same way that we mirror emotions in other humans. It's a theory founded on the fact that our brains contain mirror neurons, neurons that react in exactly the same way to our performing an action and seeing somebody else do it. Mirror neurons have explained a lot of our mimicking behavior and the way in which we make others comfortable by unconsciously mirroring them, and the emotional contagion theory takes it a step further: we feel the emotions from sad music because they're contagious.
The idea's also bolstered by the fact that there's an intriguing gap between sensing an emotion in a piece of music and actually feeling it for yourself, and that the gap seems to narrow the more empathetic you are. A study in 2012 found that more empathetic people reacted more strongly to musical pieces, even if everybody read them the same way. Davies pointed out the mirroring of the sadness in a piece of music is in fact pretty unique:
"The music is the perceptual object and cause of the listener's echoing sadness; it is her attentional focus, and her reaction tracks the unfolding of the music's expressiveness. However, the listener does not believe that there is anything unfortunate or regrettable about the music (or anything else) and she is not sad about or for the music. In other words, her response lacks the usual emotion-relevant beliefs and does not take the music as its intentional object. Despite this, the mirroring response is emotion-like rather than mood-like or irrational."
In other words, we don't feel sad for sad music necessarily; we feel sad because it is communicating sadness to us, using various codes.
So next time you feel yourself coming over all angsty because a song by Adele comes over the radio, be assured that your brain is doing a lot of complex work to make sure that you're swept away by emotion on the bus ride home.