These are all good suggestions.
Personally, as someone who's sung in a choir for a couple of years now, I can say that famliarizing oneself with music with multiple parts can help you get a feel for basslines. Doesn't matter if it's a bass guitar, piano notes in the bass clef, or you singing a bass part. Like Hypnotist said, listen to choral, orchestral, rock, and hip-hop songs and focus on the low ends...study them.
In my opinion, the bassline helps the drums carry the groove of the track. If you're working on a boom-bap type track, you might want an active, bouncy bassline. If you're working on a more somber piece, you might want something a bit more droning and less dynamic.
The two basic ways to come up with basslines have already been mentioned: (1) play a (or several) notes that harmonize with the melody and strike on each kick. (2) make a free-er bassline that independently moves with the melody.