I find that I get the best ideas either while I'm in physics class, or while I am falling asleep (or sometimes both).
I also find inspiration when I wake up early. Sometimes I'll stumble out of bed straight to the piano, and stay there writing without eating til well past noon. Perhaps hunger aids creativity? Makes sense from an evolutionary standpoint...
Something kinda cheesy is to think of something and try to imagine how I would want the music to sound along with it if I was directing it in a film. For example, if I was doing a wide shot of a lonely protagonist standing in the desert watching the sunset (coughstarwarscough), what music would best counterpoint that visual/narrative statement?
Another technique for coming up with a motif is to find a poem you like and imagine singing it. Often I find that a powerful motif can develop out of that.
Hope these anecdotes help
