How the hell does music do that?
To understand why exactly music makes it seem like less time has passed, think of the human brain as a mountain lion that is eating a bag of money. It doesn't matter what the zookeepers distract it with -- food, shiny objects or just shouting and yelling. All that matters is that they give another zookeeper the chance to sneak up and retrieve the money while the lion is busy deciding which one of them to eat.
Similarly, when your brain is steadily distracted, you'll be less likely to notice things around you in detail, and this includes the passage of time. Our brains have limited input capacity, and when something else is using up that capacity, we're less likely to think things like, "I've been standing in line to get Richard Moll's autograph for three goddamn hours" or "Do I really need this Garfield alarm clock?"
"Will Katy Perry really sleep with me if I keep buying her music?"
But it works the opposite way, too. In some situations, listening to music can actually expand perceived time. For example, listening to music while performing tasks that require concentration will usually cause us to overestimate the amount of time that has passed. The theory is that as your mind switches back and forth between perception of the music and concentration on the challenging tasks, it forms separate "events," or distinct memories. When your brain thinks about what you've been doing for the past hour, you'll remember more of these events and recall that the hour was quite long.