This happens when I get really OCD about things. I start to visualize fully-formed solutions to problerms. For a while I thought this was a superpower, but after experiencing it a few times, I noticed that when I got OCD, I couldn't be around other people, and my physical health dropped noticeably as I ignored food. I suspect a number of well-known mathematicians experience this.