A question almost every writer will be asked at some point in their lives is: where do you get your ideas from?
Agatha Christie allegedly used to answer this all-too-often asked question by replying, "From Harrods, of course: where else?"
Terry Pratchett postulated that ideas are like lightning arcing through the air in search of the right head and that it was equally possible for an idea about quantum mathematics to hit the head of a camel as it was to hit the head of Einstein - which goes some way to explaining why camels look so permanently surprised.
I began thinking about this after a series of incidents where I have woken up at 3am with an idea bouncing around in my head and had to find some way of recording it before it was lost forever. Where did this idea come from? Why did it arrive at 3am? Why is it not possible for it to arrive at a more convenient time: for instance when I am sat with a piece of paper trying to come up with an idea.
I suspect that the amount of times that someone, even a great songwriter, sat down and said "right: let's create a classic song" and then did so are quite small. Sure: there are plenty of people who can bash out hit single after hit single on demand and make a living out of doing so - but the truly great songs...well, I suspect they are a bit harder.
Elton John, I believe, allows himself a maximum of one hour to find a tune for the lyrics that Bernie Taupin has supplied - if he can't get to grips with it in that time then he abandons the song and moves on - personally I don't know how one would go about writing a set of lyrics and then handing it over to someone else to come up with a tune, but I would imagine that Bernie has to write quite a few lyrics before he finds one he thinks suitable to present to His Eltonness
The truth is that there is no easy formula or solution to this - otherwise we'd all be doing it: but here are a couple of examples of how you can start:
#1: Some form of physical exercise.
Preferably in the middle of nowhere and with no recording implements so that you have to keep repeating the idea to yourself until you get to a notepad/mobile phone/handily placed secretary - there's something about the motion and rhythm of exercise that is beneficial - particularly to song writing which is all about rhythm and movement
#2: Talking to yourself.
Some people say that talking to yourself is the first sign of madness: I say it's rude to ignore the little pixies. However: talking to yourself is a way of externalizing your thoughts and making them solid - if you really allow yourself to relax you will often find yourself thinking in ways that surprise you and saying things that you have no idea where they came from. If you get embarrassed talking to yourself try talking to the cat instead.
#3: Being in a creative space
Some of the best ideas come purely from being around other creative people and doing creative things - more than a few of my songs have come from just mucking around on the guitar and seeing what happens. Most famously Dave Gilmour (Pink Floyd) has said that the notes for Shine On You Crazy Diamond just seemed to fall off the guitar - most likely whilst he was playing around and seeing what would happen
#4: Listening and giving it time
Some of the best songs I have ever written have come from things that people have said to me that have stuck in my mind. Most recently a friend was telling me about her violin and it's history and it just stuck with me: I knew somewhere in the back of my head that there was a story to be told, but nothing came through immediately. Then, one night, I woke up at 3am with a fully formed chorus in my head.
#5: Try not to interfere too much
I read an interview with Bono some years ago where he said something along the lines that songs were ideas floating in the air and that the more you reached for them and tried to catch them the more you changed the shape of what they were - scraping away the imagery this essentially means that the more you let the idea occur naturally the more pure it will be and that sometimes by messing around with an idea too much you can break it. Having said that: the above mentioned song about the violin took me two days to finish writing, but is probably the exception to the rule as I usually try to get the idea down fairly quickly
Ultimately if you have the time and patience to do so you should spend some time trying to be creative every day. I saw an interview on TED some time back about creativity where the speaker said "Inspiration may not turn up: but you should" - and it's true, because if you train yourself to be receptive to the ideas that come along then they are more likely to materialize in the first place.