Normally ideas happen when I'm away from any instruments, so I have to commit them to memory or cell phone or paper so I can work them out later. Usually they end up being scrapped because they don't sound as good recorded as they did in my head.
On the rare instances that I sit down to try to write something, I like to think of it as a random process. I noodle around and try different notes/patterns/chords/sequences until something sounds interesting enough to develop further, then I start keeping the parts I like and changing the parts I don't like. It's always a very natural process with me, and the stuff that just seems to "come to me" I would attribute to randomness. Kind of like hitting the jackpot on the 1st pull of the handle. It's unlikely, but entirely possible. Normally it takes about 34 pulls of the handle to make the machine pay off for me in any way.
A very "un-spiritual" and perhaps boring way to look at it, but yea, thats kind of how it works for me.
I could bring in a Natural Selection analogy to make it even more boring and lame sounding if you want, haha.