People often ask me how I write songs and if I can teach them how to write their own. The simple answer is no, I can't. Songwriting is unique to each individual person. There will be many books and articles out there on how to write the 'perfect' song, but honestly? It's mostly complete rubbish. There is no single way to write a song every time.
There are methods out there that say you should take a theme and write as many words as you can think of about this theme on a piece of paper before beginning. Some people do find it easier to do this, and then begin to figure their song out from there, but it is not always necessary.
One method can be to choose the title first. But then, you have to be sure that it is a title that means something to you. Writing songs for songwriting's sake is never going to make a good song. Good songs should touch people, and mean something to yourself so that you enjoy performing them. My song Your Only One was written in this way. I was sitting there, feeling sorry for myself and wishing I meant everything to somebody, when suddenly I thought 'screw this, I don't need anybody, I need music!'. So, I took out the ol' uke and sat down. I messed around singing and trying to find a chord progression that fitted with the tune and suddenly a song was born.
In general, this is my preferred way of songwriting despite the fact that it has no structure. However, I have also used other methods, such as creating the instrumental part totally before the lyrics. This works because you can create a perfectly theoretically structured piece of music to mold your lyrics around. Helpful, because the music can serve as a huge source of inspiration as to the mood and theme of the words you choose.
There are many other ways that people use too. Sometimes the inspiration just hits you, and you can just write it straight out. Some songs totally write themselves. They key is, not to necessarily take a scientific approach to it. If you do that, your music will most likely be boring. Experiment, let the music flow through you. Often, I pick up my instrument and record me just randomly jamming and singing any lines that come into my head. Of course, this leaves me with recordings of nonsense, but they are like little pots of gold. Each of them has some line in that I can use somewhere, and often more than one. Just experiment, and see what you come up with.