There's no real big theory behind it. Scales are basically used to harmonize over certain chords. So first you must understand what chords are being used so you can choose the appropriate scale or scales. So say you have a chord progression like this:
Dm/ G7/ Bdim7/ Cmaj
Now you could approach this several ways. You could just play a C major scale over it. Or you could break it up so that you play a different scale for each chord.
Dm- play D dorian mode
G7- G mixolydian mode
Bdim7- B whole-half scale
Cmaj6- C major scale
Now here's how you come up with this. Take a look at the chord progression and you can see it easily fits with in the C major scale. The C major scales contains these chords,
Cmaj, Dm, Em, Fmaj, G7, Am, Bdim. 3 out of 4 of those chords are there, the only one that isn't exactly the same is the Bdim7. The Bdim is there, the seventh is just added for harmony purposes.
Ok now the first chord, the Dm. Which is the second chord in the C major scale. What is the second mode of the C major scale. It's Dorian, so you use it over the Dm chord. It's actually still the C major scale, your just using a different root.
Now the second chord the G7, and in the case of C major: it's called the Dominant Seventh Chord. There are quite a few scales that work nicely over this chord, but none as good as the Mixolydian. Since it is the 5th mode in the C major scale.
Next is the Bdim7. This chord is rather unique when it comes to chords. It's a symetrical chord, so your going to want to use a symetrical scale over this chord. The one I chose is the Whole-Half tone scale, which works great with a dim7 chord. The others are Whole Tone, Half-Whole Tone, and Diminished Whole Tone scales. The Whole Tone scale also works great over dim7 chords. The Diminished Whole Tone works well, but I would chose one of the other two first since it leans more towards altered chords (#9) . The Half-Whole Tone also works better for altered Dominant chords (b9 chords).
Last the C maj, well that's easy. The C major scale is your best bet. It's also finished the on the key of the song, which is very good idea.
Now if you want more info, I suggest looking into Chord and Scale formulas. If your looking for the theory end of this, that is where it is. It's too much to write on just one post, but here is one example. Taking the Bdim7 chord and the B whole tone scale. Here's how it works:
Bdim7 formula: 1, b3, b5, bb7
B whole half tone scale: 1, 2, b3, 4, b5, b6, 6, 7
Look at the similarities, they both have 1 (obviously), a b3, and a b5. The components of a diminshed chord. The bb7 on the other hand is also the same note as a 6, and the scale contains a 6 so your ok. No scale is written with double flats, so it's usually written as one number below. As you can also see there are two 6's in the scale, one flattened and one natural. The flattened one is used more as leading tone to the natural 6.
Hope this helps. Latr
"My whole life is a dark room...ONE BIG DARK ROOM" - a.f.i.