A run starts in your head - you hear something you want to play and then you play it. How do you play what you hear? You can use tools like scales, arpeggios and target notes.
If you're playing over an A major chord, start trying out some different things. Play an A major arpeggio, then the A major scale going up and down, A major pentatonic scale etc. Get those sounds in your head. Then when you're playing a song you will start hearing some of the things you've been practising and you'll know how to play it.
Go slow and simple at first, there's no point in trying to come up with amazing runs because you just don't have the knowledge and skill yet. Most people want to hear the bass play simple fills anyway...
Check out
Scott Devine's lesson on expanding your bass lines. By just using roots and fifths you can already get great sounding bass lines. Then try to add some other things like a simple pentatonic scale.