If you know all the chords of the progression, you could write down all the notes used in those chords, count the number of sharps/flats and find the key signature which has the same amount of sharps and flats. For example, let's say we have a chord progression which is D, Em, G and A. If you write down the notes of all those chords:

D major: D F# A
E minor: E G B
G major: G B D
A major: A C# E

You'll see that there are two sharps, F# and C#. Knowing the circle of fifths might help, because those two sharps tell you that the key is D major, since it's the only key with two sharps in its key signature. This method does however not always work, since if the A major chord would've been left out of the progression, we would've been left with one sharp (F#) making the key G major. I suggest learning some music theory, it will all become clear.

Sometimes I can hear what key it is just by playing the chord progression, but that's a matter of training your ears.

Improvising around those chords can be done in a multitude of ways, and I'll leave that answer for someone who knows enough about the subject to explain properly.
Last edited by Cerasti at May 18, 2008,
UG is not the only place where you can find information about music theory; I would recommend learning from multiple sources. Start with the basics -- learn where the notes are on the fretboard, what intervals are, the major scale, and basic triads. Don't move on until you've grasped the concepts of each part.

This is a nice page. Scroll down a bit and work your way through the pages, at your own pace. Picking up a book on the subject could also help.
Ears training.
You can also just look at the Key signature on the left hand side.

The basic triads will help . You'll hear the difference between maj
min and dim.

It won't help you on all song..but it'll help.
If you know the invertal of a diatonic sytem and I,IV,V =maj
II,III,VI= min

Knowing that the Dominate( V chord) are mostly played with a b7
example.. D7, you can pretty much figure out that it's in the key
of G

Example if you hear or see Dmaj and C#min...being familar with
the invertals...you can reason that the Dmaj is the IV and C#min is the III.
This will be in the key of A

It won't be in the key of Dmaj becuase the VII is a diminished.
To be in the key of D.... it'll be Dmaj, C#dim

little stuff like....
Last edited by Ordinary at May 18, 2008,
I'd recommend picking up a copy of The Complete Idiot's Guide to Music Theory if you want to get into learning theory. It taught me quite a bit.