Besides the usual entertainment value people listen to music when they are feeling depressed, sad, or if they have gone through a rough time. Turning the volume up all the way helps block out the various sounds of the world around you and enables you to forget reality, for a little while at least.
For someone who has their personality based around this trope see Headphones Equal Isolation
This is, of course, Truth in Television
- In the anime Elfen Lied, during her horrible childhood, a lonely Lucy meets Kohta and spends the summer with him. One of the most notable things they did was sitting out in the rain together while listening to the song "Lilium" coming from Kohta's music box. For the first time in her life, Lucy closes her eyes and is able to forget everything terrible that's happened to her thus far, for a moment. At various points during the series she hums the song, reveling in the wonderful memories she shared with Kohta. In her words she "was able to survive that long because she clung to the hope that she would be able to meet Kohta again someday and apologize".
- Shown above, in the earlier episodes of Neon Genesis Evangelion Shinji regularly listened to Track 25 for "You are the only one" and Track 26 for "Blue Legend" on his SDAT player in an attempt to shut out the world. In episode 25 when the batteries finally go dead, he ignores it, which is a sign of his increased apathy.
- Xander plans to do this when Buffy rejects him in the first season of Buffy the Vampire Slayer.
"I'm just gonna go home, lie down, and listen to country music. The music of pain."
- In Angel, not only does Angel listen to music when he's depressed, his song of choice is Barry Manilow's "Mandy".
- Edward in Twilight listens to music in his car to calm down after meeting Bella and almost killing her.
- In Lilo & Stitch, Lilo slumps down on the floor and listens to "Heartbreak Hotel" after being rejected by the other girls.