I'm sure you can see that repeated questions aren't a big hit, however I'll give it a shot (if i can).
There is only 1 steadfast rule for determining this, it works everytime, and it's simple too. If it sounds good then you can do it, if it doesn't sound good then you can't.
I bet that is a very unsatisfying answer so I'll go on. There are so many exceptions and different ways to go about it that if you tried to come up with a strict way of doing it you're putting yourself into a box.
One way that I do it is I figure out what the root is, then I find a scale that has the relative chords for that progression. Just say C, G, Am, Em. The key of C is: C, D, E, F, G, A, B, C. So that looks good. The maj/min (uppercase/lowercase) for major keys are I, ii, iii, IV, V, vi, viiš, I. so the chords fit that, so i can play the C major scale with this. It turns out that the scale G major also has these for it's relative chords, so can do that too. But I can skip scales all together and instead focus play the notes that are contained in the chords too.
Or for a blues progression in C: C C C C F F C C G G C G, I can play the C major blues scale (C, D, D#, E, G, A, C) for the I chord, then the F major blues scale during the F chord, then G major blues scale during the G chord.
So basically we are lost for rules to help us figure things out...but in return we get the freedom to do things based on style and preference, and to do things our own way.

If you learn how to play songs, then you learn songs. If you learn how to improvise, then you learn music.