Could be a form of an occupying thought. Sometimes it can be just listening for the slightest little sounds in your bedroom, or maybe thinking about tomorrow's problems, or your worries, or just about anything. But they all can disrupt sleep. Best to try and turn off that music in your head ASAP, before it gets entrenched. Sometimes you need to get up and out of bed to break the pattern. You can also try deep breathing and progressive muscle relaxation to help you fall asleep.