always to a beat.....gotta make sure the beat, lyrical content/subject go well with each other....
here's how I usually write songs...
listen to beat, see what's a good subject for it
write hook.......get the concept going for entire song....
write verses.....work around the concept, maybe tell a story....or tell 3 different points/views (3 verses) about the subject..