You might have already known this intuitively, but science has confirmed that you do your most creative thinking when your mind is allowed to wander a little. When it comes to creativity, the most flexible and facile mind is an "unloaded" mind—unloaded, meaning: you're not trying to think about other things. Which helps to explain why a lot of people have their most brilliant thoughts in the shower.
In an experiment conducted at Bar-Ilan University in Israel, researchers prompted participants with a common word, like "shoe" or "white," and asked them to say the first word that came to mind. While playing the word association game, participants were also asked to perform one of an assortment of other mental tasks, ranging from fairly simple (remembering a 2-digit number) to pretty hard (remembering a 7-digit number). The study participants with the hardest tasks gave the most obvious answers (like "sock" for "shoe"), while the ones with the lighter mental 'loads' were more creative ("cloud" for "white"). The unloaded mind, the researchers suggested, is more playful, with a tendency to produce the unexpected and the unusual.
Which points to the seemingly contradictory conclusion that you actually think better when you are not trying to think at all. Showering is one of those few times when we give ourselves permission to not think about much of anything—which means that the shower is actually one of the very best places for creative thought.
Other worthy candidates: On the toilet, in the hallway on the way to the toilet, waiting on a subway platform (provided you are not looking at your phone). I also find that I think some very high-quality thoughts while doing the dishes.
So (as long as this article didn't just jinx it for you!), if you're stuck on that project, it might be wise to head to the bathroom.
Read more about creativity and the unloaded mind at NY Mag's Science of Us.