what causes this auditory persistence illusion?
It sounds like you are describing an earworm, which is a piece of music that repeats in your head even though it is not actually playing. This is a rather common occurrence, and matches your experience of it happening only with songs you're familiar with, and especially so for repetitive songs. What makes songs get stuck in your head is not fully understood, but research has shown that has to do both with qualities of the song (certain melodic elements, intervals, tempos and repetitions are more likely to be earworms), as well as qualities of the listener (having a musical background, obsessive-compulsive tendencies, and being in a non-focused mental state increase likelihood of experiencing earworms).