Where do those songs stuck in your head come from? Everywhere.

Even something as tuneless as reading a psychology research paper can get a song stuck in your head. In my case, it was “Mistaken for Strangers” by The National, which has a quirky drumbeat that is particularly sticky. It’s like, bum BUM bumbum badabum, bum BUM bumbum badabum. And so on, you get the idea.

Ok, this particular paper is about getting songs stuck in your head, so while it may be ironic, it wasn’t completely counterintuitive that it would happen to me while reading it (the song is mentioned in the study).

But the research in question, which sought to classify the circumstances that lodge little tunes in our brains — Involuntary Musical Imagery, INMI, or just “earworms” — found that the set of contributing factors are more varied and complex than you might think. Earworms are ubiquitous, and the circumstances associated with them run the gamut from banal to mathematic to profound.

The analysis of hundreds of reports from people with songs stuck in their heads found that, aside from the most predictable triggers, like hearing a song recently or repetitively, there are many other complicated and interrelated contributing factors involved. In fact, second to hearing a song and getting it stuck in your head, the most common circumstances involved were non-musical memory associations.

So one subject would get the Duck Tales theme stuck in her head because her toddler simply watches Duck Tales all the time. But another would hear Anika Moa’s “Dreams in my Head,” just because a new crush reminded her fondly of an old relationship, from a time when she was frequently listening to that song.

The study—led by Victoria Williamson of Goldsmiths, University of London—consisted of a data analysis of thousands of voluntary descriptions of people getting songs stuck in their heads. The reports came from two bodies of information, a survey conducted by researchers, and reports collected from a BBC morning show in which listeners would call in and describe their earworms of the day.

Aside from exposure to a song, the most common set of triggers involve association. That could be association to a specific word, phrase, or even letters, as was the case with one woman who said a license plate “EYC” got “PYT” by Michael Jackson stuck in her head.

But it could also mean an association with a particular person you bump into, or an experience. There’s a kind of mental “time travel” involved in the recollection of an event, and often with the retrieval of that information a song comes along as a hitchhiker.

For example, one man reported that every time he drives a specific stretch of road in Blackpool, a coastal town in the UK, he gets the folk tune “Portsmouth” stuck in his head, because it was playing the first time he ever drove that road—in 1975. It sticks with him for about a day each time.

Mood and setting also come into play, with subjects reporting times of stress, dreams, and mindless periods of repetitive work as contributing factors.

The body of research about earworms is relatively new, and the authors acknowledge limitations in their data. But the more researchers look, the more it seems that they are a lot more complicated than hearing a song on the radio, and that musical memory is pretty tightly woven into our other memories. They’re also just about as hard to predict or control.

Fortunately, I happen to love the song “Mistaken for Strangers,” and it takes me immediately back to the time when it first came out, about five years ago. I had just moved from Portland to Denver, I didn’t have a lot of money or friends and I used to walk around Capitol Hill listening to it on headphones. I found a neighborhood bar called Gabor's, it’s since closed down, and they had this great jukebox. And so on, you get the idea.

How do “earworms” start? Classifying the everyday circumstances of Involuntary Musical Imagery