Does anyone have advice or tips for doing this? Some guys really know how to bust them out. Do these people just intuitively know what scale they're playing in and are able to come up with notes that fit the song, or do they know very well what they're playing in beforehand?
I can only speak to what I do. I know the scale we will be playing in before I start playing - because it's a given that everyone just needs to know that. Our director always calls the song title and the key we are to use.
The person calling the song says: "The next one is Kiss Ole Kate in D, ready 1 & 2 &........."
Or the sheet music will list the key the song is to be played in. And then you know what notes to use.
Most do not, just intuitively know, what scale to use as the scale (key) being used can very. One vocalist may want it in D and another would want it in A. So it's expected that someone will call out the key to be used.
Now if no one calls the key then it's left up to you to find the key. How? Use your ears. How? Fastest way is to ask someone; "What key are we in"? Or, run the G string up the neck - when what you are doing and what is being played sound good together you've found the tonal center (the key) look down at what note that happened on, that's your key.
IMO you gotta know the key everyone is going to play in so everyone will be playing the correct notes.
Now which notes? As fills, the chord's tones. Cmaj7 R-3-5-7. Or C major pentatonic over the C chord. Or ........... this will take us into building walking bass lines or improvisation, and that would be best handled in another post.