The important thing about the bass is that it's the bridge between the drums and the other instruments. How it fills that role is massively dependent on the musical style, the conventions of that style, and the song itself.
The most basic bassline of course is playing a low root note of the current chord on the "one". And honestly, sometimes that's exactly what you need. John Illsley does not much more than that in Money for Nothing, for example. The effect is to give an "insistent" feeling to the music.
The classic "1-5" bassline is very standard in rockabilly. It's pretty cheesy, but it works in context.
Typically the bass adds the passing notes to the next chord (think Love Letters by Ketty Lester). Again this can be somewhat predictable depending on the context, but it often works.
Disco needs a strong downbeat on the "one", but then may have more going on during the bar (think Superstition). Alternatively there's the "four on the floor" disco bassline which again has that insistent quality by its repetitiveness.
African music (and often reggae) may lead with a higher root note on the "one" and then go lower afterwards, inverting the usual rock/pop style of starting low and then doing higher fills during the bar.
Then there's timings. As the bridge between the drums and instruments, a lot depends on how the bass works with the drums. Disco and rock generally have the bass very tight to the drums - Blondie may be the tightest drum/bass pairing ever for this, with Call me being perhaps the finest example. Alternatively the bass may lag the drums slightly, which tends to also pull the other instruments slightly behind the beat, creating a more "lazy" feel.
And lastly there's just getting a good hook going. It has to serve the rhythm, but it also has to serve the song. This will usually either provide a jumping-off point for the rest of the instruments (You can call me Al by Paul Simon) or act as a counterpoint/foil to an instrumental hook (Sweet child of mine).
Or in the ultimate case, perhaps you don't need a bassline at all. When doves cry by Prince has no bass.
The main thing for bass and instruments though is that they must not tread on each others' toes. The higher notes on a bass and the lower notes on a guitar cross over; and of course a piano has a massive range too. EQ sculpting can help with this a bit, but really this comes down to your arrangement.
Like all things musical, there are many ways to do it! And as always, if it sounds good, it is good.