I can spend ages trying to come up with an idea for a poem or solution to a problem, but they usually do not come until my mind is completely unoccupied. Most often my ideas come when I am not in reach of a pen and paper, such as when I'm in the shower, or just going out for a walk. It is great feeling to get that sudden spark, but annoying that by the time I get within reach of a notepad, I've forgotten it all.
Like soupson, I come up with my ideas in bed. Usually after I've fed Baby and am trying to get back to sleep. I like to keep a pen and paper handy to jot down ideas I think are worthwhile. While studying education, I actually read that ideas tend to come to us when we are otherwise occupied and least expect it.