You know the 7 modes? If not, learn them.
Modes in a nutshell are the major scales but they displace the tone center of the scale. This sounds fancy but its easy to comprehend.
Ex.1 Lets use the key of C for example and a simple chord progression, 1, 4, 5, (C-F-G for two bars on G.) Since we're in the key of C and playing the 1st Chord in the key of C, lets play the major scale starting on C in 1/8 notes over top of this 1st chord, C Maj. The notes you would have played are C-D-E-F-G-A-B-C. Then when the chord goes to the F or 4th chord, lets play the C major scale again in 1/8's
but we'll start on the F instead of C. The notes you would have played are F-G-A-B-C-D-E-F. Finally we do the same on the 5th chord or G. G-A-B-C-D-E-F-G-F-E-D-C-B-A-G-B and back to C for the first chord again.
Ex. 2 Same chord progression but instead of just playing the C major scale on the C, the C major scale starting on the F and then the G, lets improvise a melody line over these chords in the key of C. The only rule is, When the C chord starts, you start from the C. Then when the F comes, you start your improvising from the F, but still playing the notes in the key of C. Then finally you improvise in the Key of C, starting from the G.
Ex. 3 New chord pattern, 2,5,6,1 (Dm-G-Am-C.) Repeat Ex.1 and 2 using the same rules. Play the notes in the Key of C, (Cause thats what key we're in) but play the C major scale starting from the D first, G second, A third then C fourth.
There's a book for this stuff called Modes for Guitar:
http://www.amazon.com/dp/0634018779/?tag=hashemian-20Not sure if this is what kind of stuff your looking for or if its the theory behind it. The theory has to do with the intervals. On the first scale you play C-D-E-F-G-A-B-C, or Tone, Tone, Semi Tone, T, T, T, ST. Over the Am chord you'll play A-B-C-D-E-F-G-A or T, ST, T, T, ST, T, T. Notice that
by playing the exact same notes but by playing them from a different starting point, the scale behaves differently. If you play the C major Scale starting on C over both the C and the Am, the scale sounds happy, but play the C major scale starting from the A over both scales, your scale sounds sad. So, you asked, what scales to play and when. Well... what do you want to do? In the first two example chord progressions we did 1,4,5 and 2,5,6,1. You can either follow the chord changes and when the chords go major, you play major, and when the chords go minor, you play minor. Or, you can do the opposite. Or some with the chord changes and some against it.
That help?