Interesting thread especially as there is a similar one right now as well. It is the right question to be thinking about!
I would default to chord tones on the strong beats of the measure you are are on, and then construct a "bass melody" that leads to playing the root on the "1" of the next measure, often this means that beat 4 of the current measure will have a leading tone a half or a whole step above or below that (new) root note of the second measure. So if the first measure was C major and the second measure was Ab7 (clearly not in the key of C), I might just walk up to the G on beat 4 (example C-E-F-G) and then we would be a half step below the Ab, ready to pounce on the one (Ab). Then, it starts all over again on the Ab, but we would no longer be thinking in the key of C at that point.
For some chords, we may want to think of their function rather than the strict harmony implied by their chord tones. A lot of jazz is written around the idea of a ii (minor7), V (dominant 7), I (major or minor) progression. And sometimes this turns into say a iii-VI- ii-V-I (which is really just 2 ii-V-I progressions, one resolving to the other). Or, we may see a ii-V where the V then becomes minor in the next measure, and then a new ii-V begins. Example: Cm7-F7-Fm7-Bb7-Eb. You can work out a scale where only one note changes with each chord change. This is harmonic movement - Keyboard players are usually quite good at this. But its important look at where the harmony is leading - in this case the Eb. So the whole thing could be thought of in Eb. In this example the note Bb in the first chord drops to an A in the second chord which drops to an Ab in the 3rd chord, then you might emphasize the D (3rd) in the Bb7 chord before resolving to the Eb in the last chord. These are just important chord tones to outline the harmony, which the chordal instruments are already doing, but you are also expected to delineate the roots. That along with the groove is your job. So now you have two important notes for each chord, the root and the "important chord tone" and any additional notes can be thrown in just for connecting the two and leading to the next chord.
Often the most expressive notes you can play seemingly have no business being in the current measure, but if they clearly lead the listener to the next measure they are pure gold. Using the iii-VI-ii-V-I example (In C major: Em7-A7-Dm7-G7-C ): Assuming 2 beats on each chord you could play E Bb A Eb | D Ab G B | C. At first glance the Bb, Eb and Ab might seem to have no business in a progression that is clearly in the key of C (or nearly so, as the A7 is a slight variation). But if you try it you will see that these notes serve a simple function of getting you to the next chord as they are a half step above or below the next root. Of course you could also play the notes E B A E | D A G B | C and stay 100% inside the key, but this might sound too "square" or "inside". Then again you might want that, or may want a mix of the two.
You can spend a lifetime on this stuff! Ultimately if you are hitting the roots and holding the groove you are doing your job. The rest is style points. Not every measure needs to be perfect if you are holding down your job, and whatever measure you just played is not nearly as important as the next measure!
