Sometimes I’ll get a song stuck in my head for a month like that. Other times it will be for a few minutes or an hour. It doesn’t seem to matter if it’s a song I hate or a song I love (or at least a song I loved before it got stuck in my head). Right now, like most of England, I have “Football’s Coming Home” stuck in my head.

Some songs get stuck in my head a lot, but others don’t: "Missing" by Everything But The Girl is a repeat offender, but I don’t recall ever hearing Nicki Minaj singing "Super Bass" on a loop, despite having listened to it many more times. According to Steven Brown in his paper "The Perpetual Music Track: The Phenomenon of Constant Musical Imagery", some people can have songs stuck in their head more or less continuously! What the heck is going on, and more importantly: how can I make a stuck song go away?

There are lots of different ways and reasons that we might get music stuck in our mind’s ear, as it were. There have been rare occasions when I’ve been learning a song and have returned to it again and again voluntarily because I want to remember the words and the tune for when I later sing it. However, most of the time, the song just arrives without me having to do anything about it – which among psychology researchers is referred to as involuntary musical imagery, or INMI.

Not every experience of INMI is identical. Tim Williams suggests lots of different categories, including earworms. These are songs that are stuck in your mind’s ear, sometimes to the point of irritation, but without any other effect on your daily life. They seem to happen to just about everyone at some point or another, as was found in a global study of people’s (English-language) tweets about earworms.

Nicki Minaj

I’m going to concentrate on earworms as they’re so common, but just for interest, here are a couple of other categories of INMI that Williams mentions:

  • Musical hallucinations: Thinking you’re hearing music when there isn’t really any music there – unlike earworms, where you’re aware that the music is occurring in your mind’s ear. They might happen because of hearing loss or brain injury.

  • Musical dreams: While you’re awake when an earworm happens, it’s possible to dream of hearing music. It might be familiar music, new music or a variation on something familiar.

Williams points out that researchers in this field are not necessarily very good at specifying when they’re talking about earworms as opposed to talking about involuntary musical imagery generally, so bear in mind that the research I cover below might not only be about earworms.

Why do earworms happen?

In a 2015 study, a group of participants were asked to fill out questionnaires about earworms while they were going about their daily lives. The study found that earworms are particularly likely during tasks which have low cognitive load (that is, you don’t have to think about them much). These are tasks like waking up, travelling, housework and physical movement. The researchers also pointed out that to some extent these activities are constrained by the time of day, so there are regular times when an earworm might be particularly likely, like your commute.

Interestingly, another study "Going Gaga" found that it’s not just low cognitive load that can lead to earworms – it can also happen if your mind is overloaded. In the study, people were played three well-known songs and then asked to do either very easy or very hard sudoku puzzles. While both groups of people experienced earworms during the sudoku task (typically the last song they had heard), the group who’d done the hard puzzles reported more earworms.

"We can’t spend our lives avoiding fast-tempo, popular songs, or never letting our minds wander, so earworms are pretty much inevitable."

Why do both hard and easy tasks open the door to earworms? Well, if you’re not very engaged in a task it’s easy for your attention to slide, which might happen because you’re bored with it or because you’re overwhelmed by it. There is really only a narrow set of tasks that are the exact right amount of ‘challenging’ for you to become absorbed in doing them! When you’re not doing one of those tasks, the mind can wander and you start thinking about something else, like Harry Potter, or tea and biscuits, and then suddenly you’ve got “Man Don’t Care” by JME on repeat in your head

This can’t be the whole story, though, because there are lots of times when our minds wander and we don’t end up with an earworm. Dr Victoria Williamson and colleagues found that earworms could be triggered by a wide variety of events including recent or repeated exposure to a song, an association of a song with a location or emotion, and being under stress.

So, there are many contributing factors in getting an earworm that come from events happening inside or outside ourselves. But why do we get one song in particular stuck in our heads?

Lady Gaga

What kinds of songs become earworms?

In what sounds like a gargantuan effort (because they had to verify that each and every song listed was a real song), Kelly Jakubowski and her colleagues asked thousands of people to list their most recent and their most frequent earworms, and then sorted through them to find out what characteristics made a song likely to be an earworm. So that they could measure popularity and recency easily, they used only listed songs that had at some point appeared in the UK music charts.

Three of the top ten most listed songs were by Lady Gaga ("Bad Romance", "Alejandro" and "Poker Face"), along with "Can’t Get You Out of My Head" by Kylie, which seems a cruel irony.

What do all these songs have in common? They have a fast tempo, they had been recently released at the time that people were filling out the questionnaire, and they were popular, meaning that you’d have heard them a lot on the radio, in stores, or blasting out of other people’s cars as they sped by.

This fits with a much smaller study on a group of students in Texas, which found that Christmas songs were likely candidates for earworms – presumably because they’d asked for earworms as Christmas was approaching and many stores and radio stations in the area were playing Christmas songs.

How can I get rid of an earworm?

We can’t spend our lives avoiding fast-tempo, popular songs, or never letting our minds wander, so earworms are pretty much inevitable. Luckily, a 2014 study looked at how people cope with earworms when they find them distressing. Here are some tips based on its findings:

  • Distract yourself by listening to other music, watching TV or chatting with people – anything that gives you something to listen to that’s not the earworm. Some people have a go-to song that can block the earworm but doesn’t become an earworm itself. Mine is "Walk Like an Egyptian" by The Bangles, and I have no idea why it works.

  • Listening to the earworm song in its entirety could also help, though there’s some conflicting evidence about this.

  • You could try combining the above two by listening to the earworm song and then immediately afterwards listening to other music, though it’s not clear if this is more effective than just listening to other music.

  • Distracting yourself with something purely visual or spatial like a sudoku or a Rubik’s cube probably won’t work as well as listening to another song, because there’s no other noise.

One final means of getting rid of an earworm is my own theory. Please note that this is just a theory, I haven’t tested it and I have no idea if it is something that would work for other people. For me, earworms are sometimes my subconscious telling me about things I need to deal with, and they go away when the problem is resolved. For example, after someone broke up with me I ended up with Reef's "Consideration" stuck in my head, a song I hadn’t heard for about 15 years. The specific lyric I kept hearing as I trudged, Charlie Brown-like, through the streets of north London was, “I don’t think that kindness is a weakness.”

I am pretty certain that was my subconscious telling me that the relationship would not have worked anyway because kindness is a thing that I value very highly (yes, I am a Hufflepuff, hello), but it was not very important to the person who’d just broken up with me. After a few days of having this earworm, I attempted to get rid of it by listening to it the whole way through and found that I’d been sending myself another message: the end of it is the repeated lyric, “It’s gonna be all right.”

And, funny story, it was. The earworm went away once I started to get over it, and hasn’t come back since.

This article orginally appeared on That Thinking Feeling. Clare Jonas is a science communicator with a PhD in psychology. She enjoys the music of Four Tet, yelling enthusiastically about science, and attempting to guess the names of other people’s dogs.