Because it denotes the successful completion of a task and you feel as if you have accomplished something. This clears the mind and allows creative juices to flow and voila: a great idea!
HaHa, I always think of my best stuff in the shower and I always have to go to the bathroom when I’m in the library. Thinking and bathrooms go hand in hand. Maybe the bathroom is the place where we know we are (typically) most alone, and allow the mind to ponder on things.
Driving and showering, for example, are right brain activities, which is the creative side of the house. Stimulating your right brain is what spawns creative ideas. Steven Spielberg always carried/carries a handheld recorder when driving for that reason.
When you’re showering or using the facilities, you don’t need your brainpower for anything else, and there are very few distractions. In graduate school, when I needed to focus, I took a shower—no distractions, no Internet or books or music to distract me, and I could think. I think it’s exactly the same thing here.