Almost all of the explanations here boil down to descriptions of the earworms themselves, rather than an answer to WHY we get them. There are some things about short term memory and the "phonological loop" peppered in to make it sound scientific, but again those just boil down to "it's a short melody that you can hold in your memory". But of course, even after all this, none of these things are actually explanations at all! They are post hoc observations masquerading as explanations, like trying to explain "why" birds migrate by describing how long they fly, and what direction they fly in.