Do people hear the music first or write the words first? How does the "fit" work? Do you fit words to music or music to words? Are songs poems fit to music? What makes a song a song? How is it different or the same as a poem?

I'm, obviously, not a musician but I've always wondered how people write songs.