If making music isn’t the most ancient of human activities, it’s got to be pretty close. Melody and rhythm can trigger feelings from sadness to serenity to joy to awe; they can bring memories from childhood vividly back to life. The taste of a tiny cake may have inspired Marcel Proust to pen the seven-volume novel Remembrance of Things Past, but fire up the Rolling Stones’ “Satisfaction” and you’ll throw the entire baby-boom generation into a Woodstock-era reverie.

From an evolutionary point of view, however, music doesn’t seem to make sense. Unlike sex, say, or food, it did nothing to help our distant ancestors survive and reproduce. Yet music and its effects are in powerful evidence across virtually all cultures, so it must satisfy some sort of universal need — often in ways we can’t begin to fathom. A few years ago, a single composition lifted Valorie Salimpoor almost instantaneously out of a deep funk (it was Brahms’ Hungarian Dance No. 5, to be precise), and from that moment, she decided it would be her life’s work to figure out music’s mysteries.

It’s working out pretty well so far: in the latest issue of Science, Salimpoor, now a neuroscientist at McGill University in Montreal, reports, along with several colleagues, that music triggers activity in the nucleus accumbens, the same brain structure that releases the “pleasure chemical” dopamine during sex and eating (and, on a darker note, drives addictive behavior as well). Animals get that same thrill from food and sex, but not, despite the occasional dancing cockatoo, from music.

But the nucleus accumbens is just part of the neural symphony. “Music also activates the amygdala,” says Salimpoor, “which is involved with the processing of emotion, as well as areas of the prefrontal cortex involved in abstract decisionmaking. When we’re listening to music, the most advanced areas of the brain tie in to the most ancient.”

That, it turns out, may be the key to music’s power. In the experiments reported in Science, Salimpoor and her colleagues gauged subjects’ responses to music by exposing them not to songs they already knew (which might be too firmly linked to pleasurable memories of that first kiss or that road trip to Florida), but to songs they have never heard but would probably like, based on their known preferences as filtered through a Pandora- or iTunes-like prediction algorithm.

The subjects listened to the first 30 seconds of each tune while lying in an fMRI imager as the scientists monitored their brains. Then, to provide some sort of objective measure of how much the subjects actually liked each piece of music, they were asked how much they’d pay to buy the whole thing, from zero up to $2.

What the scientists found was that the songs that triggered the strongest response from both the emotional and intellectual parts of the brain were correlated with a willingness to pay more. And that suggests that people get not just a sensory reward from listening to music, but a direct intellectual one too — even if they’re not aware of it. The nature of that reward, Salimpoor believes, based on this and earlier research, has to do with pattern recognition and prediction. “As an unfamiliar piece unfolds in time,” she says, “our brains predict how it will continue to unfold.”

These predictions are culture-dependent and based on experience: someone raised on rock or Western classical music won’t be able to predict the course of an Indian raga, for example, and vice versa. But if a piece develops in a way that’s both slightly novel and still in line with our brain’s prediction, we tend to like it a lot. And that, says Salimpoor, “is because we’ve made a kind of intellectual conquest.”

Music may, in other words, tap into a brain mechanism that was key to our evolutionary progress. The ability to recognize patterns and generalize from experience, to predict what’s likely to happen in the future — in short, the ability to imagine — is something humans do far better than any other animals. It’s what allowed us (aided by the far less glamorous opposable thumb) to take over the world.

If music is tied into this most important of survival mechanisms, no wonder we like it so much. “People often put music on the list of the top five things that are most pleasurable for them,” says Salimpoor. You surely thought of none of this the first time you heard “Satisfaction” — nor would you have wanted to — but it helps explain why you’ve listened to it ever since.