There are a lot of aspiring singers and songwriters out there, but when it comes to actually sitting down and writing a song, many people just don't know where to start. The first step in learning how to write a song is deciding to stop thinking about writing a song, and just write it. Songwriting is an independent process, so until you make a commitment to actually doing it, you won't succeed.
Learning how to write a song is above all about imitation. No one is born with the ability to write good songs. Instead, they listen to their favorite artists and other recognized song writers. They listen actively and try to figure out what it is that makes the songs they really love sound good. The first step to learning how to write a song, then, is actively listening to a lot of different songs. Listen for the structure of the song (verses, choruses) as well as for the content (what it's about) and the rhyme and rhythm schemes (which words rhyme, how does he singing match the music).
Once you've gotten some ideas about what a good song sounds like, you need to get down to writing a song. For your first song, try to imitate your favorite singer. Write the kind of song you think they would write, with the same type of verses, similar content, and the same sound. Since learning how to write a song is about first imitating, you should keep imitating until you think you know how to write songs like your favorite singer.
Now, you just need to write your own song. This is the toughest part of the process, because you can't explain creativity. Be observant of your life, your emotions, and how your relationships work. As you live day-to-day, try to make up lyrics (in your mind, to yourself, unless you'd rather sing out loud) that go with your life. Now that you're really making writing a song part of your life, you'll start to notice you get better and better at it. Without even thinking about how to write a song, you'll be coming up with verses about filling up your gas tank or picking out dinner.
At this point, you need something called inspiration, which is almost impossible to explain and which you definitely can't teach. Deep down, you have something you want to say in your songs, and you need to learn what that is and start writing a song about it. Figuring out what it is, and how you want to write about it, is inspiration.
Learning how to write a song really isn't that difficult, but there are two important steps: first, you have to really want to do it and be committed to writing a song. You need to dedicate time to songwriting every day, and think about not just songs but material that could become a song pretty much all of the time. Once you become obsessed with figuring out how to write a song, writing a song is almost natural.