This has always been the hardest question for me to answer and I'm not sure what I have to say will be of any help to you. The first time I wrote anything that I thought was good enough for anyone else to see I wasn't trying to write anything, it just seemed to happen. After that happened several more times, I began to think maybe this is something I'm good at and it seemed to come fairly naturally. Composing came much harder for me and I had to really work at it; I still do. Once I decided writing was what I am suppiosed to be doing, I worked pretty hard at learning some music theory and tried to hone my lyric writing skills. It's been splurts and dry spells ever since, but I sit down and try to write several hours a day, aside from the time that I rehearse playing instruments and songs I've already done.
For me, ideas for songs come from almost everything, but especially good books, people watching and just trying to figure things out. I hope some of the other writers on the board can explain this better, but that's how I started and how I keep doing it.