Writing, for me, is all about the puzzles. I don't plot things; I write scenes as they pop into my head, and they might come from anywhere in the story. As the plot becomes more clear, the scenes get rewritten or rearranged, details changed to make everything more coherent. It's a lovely feeling when everything goes "snap" and it all falls into place.
I've noticed there are a couple ways I tackle stories in this way--create a world from scratch (especially if it's SF) or use an existing template--that is, put characters and elements of my own creation into a world based on ours.
Consort, in which my protagonist fell in love with a muse and was cursed to rise every seventeen years to exist for a month on sex and song. The basic setting was Greece and the accompanying myths and male/male sexual practices, then I mixed in elements of a cicada's life cycle which influenced the plot and outcome. I even looked up details like food and native Greek butterflies.
A more recent example where existing references entirely influenced the plot was a short story written for a call for queer stories based on Bram Stoker's Dracula. (The anthology will be out in July from Lethe Press; I don't have more details as of yet.) In that, I focused on the scene in the churchyard where the men confront Lucy in the churchyard and she's taken a child to feed on. I got the idea of telling the story from the child's point of view--but it had to fit within the world created in the book. Fortunately, that child's gender was never mentioned, so I made it a boy. I needed a plausible reason why Arthur decided to take this particular child in when Van Helsing left Lucy's other victims for the police to find--and had the child share Arthur's obsession with Lucy as he grew.
There were other details like dates--how long did the men chase Dracula? How old would the child be when everyone went back to Transylvania to visit? Where were Arthur's homes and when did he inherit his title? All little things, but necessary to the story--and fun to find out.
And that story led me to the e-book I'm working on now. I had an idea to do a Gothic. Okay; needed a moody English town. "Whitby" popped into my head. I didn't realize I'd already written about it in the Dracula short story until I looked up the town (and what a nifty town it is, too.) So Whitby is famous for its abbey founded in 657 by St. Hilda. St. Mary's Church--site of several scenes in Dracula--was founded around 1110. Then there are more local interests to add--famed explorer Captain Cook trained in Whitby, so if one of my characters went along as, say, a painter to record what he found, where would they go? Who would they encounter? What kinds of diseases might they have caught? If he brought a foreign manservant back, where would that manservant be from?
And the famed 199 steps leading from the town up to the church and the abbey--when were they built? 1710 or so, it seems, but, oh, they were wood. When were they changed to stone? 19th century, sometime, which is later than I'm setting my story, but still important to know because if someone say, needs to break his neck on those stairs, I need to know if they're wood or stone. There's a donkey trail next to those stairs, which is good to know, because I need to get a horse up there, too.
There is more, but that's probably already more than enough for a blog, let alone a book. Ah, well, I suppose I'll have to write another one, because, really, who wouldn't find inspiration for a gothic novel here?