Honestly, this is one of the most often asked questions for a writer, and really, one of the very hardest to answer. The late, great science fiction author Douglas Adams once said something about this. Forgive me for not recalling his exact wording, but it was along these lines: “All I can suggest is to drink lots of coffee and to buy a desk that can withstand having one’s head banged on it.”
Yeah, that about sums it up, though I substitute diet cola for the coffee (ick!). Ideas and inspirations float in and vanish at will. I don’t have a muse, or at least if I do, it’s frighteningly erratic. My ideas come from here, there, and everywhere, usually when I’m least expecting them. Sometimes snippets of dreams. Sometimes a tidbit of an overheard conversation. Other times, I’ll be watching a boring movie or TV show and think, “This would be much cooler if he was a werewolf and she was a leprechaun.” And so on. Generally the best ones occur when I can’t write them down.
I think part of the particuliarity that makes fiction writers, particularly speculative fiction writers, what they are is the weird ability to act as sponges for all the odd bits of whimsy in the universe. Seriously. Until I started interacting with other authors, I thought it was just me who would look at a couple in a restaurant and immediately start spinning a story in my head behind her unusual necklace, or his interesting accent. Or who would hear a single phrase out of context in a grocery line and end up building six different scenarios around it. Or watch a perfectly ordinary movie and get so irked that I had to rewrite the ending in my head just so I could put it out of my mind and get to sleep.
The real key, I believe, is taking all these bits and pieces and choosing which few to weave into a story. One cool idea does not a story make, unfortunately enough. It’s the convergence of several threads that make a tapestry, and the melding of several ideas to make a story. The difference between being an author and a lunatic may be just that simple—the ability to weave our bits of insanity together into something remotely feasible. Some days that's easy and some days it's hard. Much like those engaged in any other creative pursuit, we all have our off days, or off weeks or (gulp) off years. If we're stubborn enough to slog through it, and wise enough to give ourselves time for other parts of our lives in between, we come through on the other end with a creation that appears to the reader as an effortless and seamless flow of perfectly linked ideas.