This is one of those things that a person can ponder about for a good long time. Which comes first, the chicken, or the egg?
People tend to say, "Well, what do you look for in a band? Do you listen to the lyrics or do you listen to the music?" I, personally, think that's a retarded question. I definitely listen to and like the lyrics of the band's I listen to, but if the music sucks, I don't listen to it. Music comes first for me, but I'm not oblivious to the message.
But as far as songwriting goes, for me anyway, things feed off of other things. Nothing really comes first or second, like, I don't make up a riff, dwell on it for a while till I come up with words for it. Usually I make music and words equally. Every now and then I'll think of something that sounds cool and write it down. Just jot down things that come to mind. One night when you've got nothing to do, or maybe you just broke up a relationship, or something big just happened, look at your random words and see if you can spawn something off of them. When you're emotional you tend to write with emotion. Chances are, 65 percent of the time, you'll look at what you've wrote the next day and think it's crap. But every now and then you'll come up with something cool.
Later, when you've got some music you want to add words to, look at the lyrics you've already written. See what fits and what doesn't. Move things around, change things, make things rhyme, etc. There's no specific formula to making a good song. Sure, people can write books about music theory and songwriting, but good things often don't come from following steps. They come from what just feels good.
Hope this helps!