I wrote a song, kind of a Bill Evans type song. It goes from a D minor 7 with flatted fifth to a D flat dominant 7, up to E minor, then F minor, then back down again to D, D flat and Cmajor7. It took a while to come up with the bridge.
Anyway, I don't actually know how to write songs. This is my first one and I'm sure it's not very sophisticated. The funny thing is that I can identify flaws in it and work on them or find better solutions to problems I perceive. Since I'm writing it on the piano I also have to work within my limitations, since I don't play piano very well. I have a sense of what sounds good, and can substitute a better sounding sequence of notes within the general framework. For example, in the bridge I had started three phrases in exactly the same way and I realized that the third phrase had to go in a different direction. Also, the bridge could not simply end on the tonic.
I don't have a lyric for it, but the process would be the same: trying things out and finding better solutions. Isn't 90% of work problem solving? You could write an article and reading it, notice that there are problems in the structure & organization, in the transitions, in the prose, in the argument.
In my case the song is 32 measures long and in the AABA form. Curiously, I didn't have to count measures, because this is intuitive, since I've listened to hundreds of songs in this form.