Songs or bits of songs pop into my head all the time. Back when we were all low tech, it would drive me nuts trying to remember something that I thought sounded great the day before. Now we have cell phones and computers and can record it for later study. I have woken at 3 AM and sung something into my cellphone and then worked on it the next day. I read a story about Christine McVie, the recently deceased member of Fleetwood Mac, who wrote the song Songbird. It was a big hit for them and her. She came up with the song late one night. She didn't want to forget it, so she stayed up all night playing it, and in the morning drove to a nearby recording studio and recorded it.