Having a song, tune, or commercial jingle stuck in one's head is a phenomenon known as having an earworm. Most people have had an earworm at one time. The experience is harmless and unrelated to both obsessive-compulsive disorder and endomusia, the hearing of music that is not really there. Certain songs – simple, repetitive, or oddly incongruous – have properties that act as mental mosquito bites in that they produce a cognitive "itch." The condition also arises when people struggle to remember forgotten lyrics or how a song ends.
What does the next phrase (in bold) mean in other words?
To scratch a cognitive itch, the brain repeats the song, which then traps the hapless victim in a repeated cycle of itching and scratching. Everyone has his or her own list of demon tunes that haunt.
Source: Discover Magazine