My best ideas seem to surface between one and three in the morning. My brain is usually going a million miles an hour, but being tired slows it down to a manageable level. I get pretty lucid and can imagine things more clearly, even though logic takes a backseat, haha. Therefore I get a little window of prime writing time every evening if I choose to stay up and I don't have too many stressful things to think about.
After I get an idea, I tend to let it roll around in my head for a while. Pretty much everything I write is a result of getting caught up on a particular idea for a decent amount of time, anywhere from a week for short stuff to a few years for longer projects. Basically, if I'm not sick of an idea after a while, it tends to mean I'm passionate enough to write it. During the interim I'm usually fleshing out the idea, forging connections between it and other ideas, or just daydreaming about it constantly. Every once in a while I jot an idea down, which happens more if it's about a project I'm already working on. This helps me visualize things a lot better, but I don't do it nearly as often as I should.
As for where I get ideas...commonly in the shower or while taking a walk. Music has also spawned an improbable amount of my work. Walking while listening to music is probably the most potent weapon against writer's block I've ever encountered.