As well as containing repetition, music is also unusual among the things we regularly encounter for being so similar each time we hear it. Fences are visually repetitive, for example, but each time you see the same fence you will look at it from a different angle, or in different light. Put a song on your stereo and the sound comes out virtually identical each time. Remembering is powerfully affected by repetition, so maybe the similarity of music engraves deep grooves in our mind. Grooves in which earworms can thrive.
The BBC explains earworms — snippets of music that get stuck in your head — and offers a possible solution: think of a similar song. ("My arm hurts." *WHACK* "Now my other arm hurts!") What's similar to this?