You get ideas from daydreaming. You get ideas from being bored. You get ideas all the time. The only difference between writers and other people is we notice when we're doing it.Perhaps the most annoying question that authors get asked by those who would like to write themselves is - Where do you get your ideas?, and Neil Gaiman tackles it just beautifully on his blog.
You get ideas when you ask yourself simple questions. The most important of the questions is just, What if...?
(What if you woke up with wings? What if your sister turned into a mouse? What if you all found out that your teacher was planning to eat one of you at the end of term - but you didn't know who?)
Another important question is, If only...
(If only real life was like it is in Hollywood musicals. If only I could shrink myself small as a button. If only a ghost would do my homework.)
And then there are the others: I wonder... ('I wonder what she does when she's alone...') and If This Goes On... ('If this goes on telephones are going to start talking to each other, and cut out the middleman...') and Wouldn't it be interesting if... ('Wouldn't it be interesting if the world used to be ruled by cats?')...
Those questions, and others like them, and the questions they, in their turn, pose ('Well, if cats used to rule the world, why don't they any more? And how do they feel about that?') are one of the places ideas come from.