The capo allows you to play a song in a particular key using chord shapes and formations from a different key. For example if you like to use the open (first position) chords in the key of G major such as G, C, D, Em and Am but want to sing a song in the key of A, you can put a capo on the second fret and play the chords as if you were playing in the key of G.
So when you play a G chord with the capo on the 2nd fret, it will actually be an A chord. It will look like a G chord but sound like an A chord.
To determine what key you will be playing in based on a given capo position, take the key corresponding to the chord shapes you want to play and then add a semitone or half step for each fret position. Note that there is only a half step or one semi-tone between E and F and between B and C.
So if you want to play chords as if in G and you put the Capo on the 1st fret - you take G and add one half step (one semi-tone) G plus a semitone = Ab or G# (same note on a guitar). If capo goes on second fret add two semitones - G plus 2 semitones = A. So playing a G chord formation with the capo on second fret, gives you a chord that sounds like (and technically is) an A chord. With capo on third fret - if you play chords for key of G - take G and add 3 semitones and you get Bb or A#. G-(+1Ab)-(+2A)-(+3 = Bb).
If you put the capo on the first fret and play chords as if in the key of C (such as C, F & G) you take C and add 1 semitone and get C# or Db (same note - two different names depending on the frame of reference). If the capo is on 2nd fret and you play a C chord it will sound as (and technically be) a D chord. C plus 1 semitone = C# - C plus 2 semitones (capo on 2nd fret) = D.
This formula will work for any capo position and any chord set. Another way to approach using a capo to transpose is to first decide what chord set you want to use. Then decide what key you want the song to be in. Then count the semitones between the two keys and that will tell you the fret to put the capo on. So if you want to play chords that are in G but want the song to be in the key of A - start with G (the root of the key of G that you want to play the chord formations from) and count to A in an ascending direction - and you get two. G-(+1G#)-(+2 = A).
Sometimes you will find that this approach puts your capo on a fret too close to the body to play comfortably. For example - if you wanted to use G shaped chords to play in the key of E you would go G-G#(1)-A(2)-A#(3)-B(4)-C(5)-C#(6)-D(7)-D#(8) - E = 9th fret.
Ninth fret leaves very little room to maneuver so you could look at alternative chord sets (if for some reason you did not want to play the chords from the E set of chords). For example - it's easy to see that the distance between D and E is much closer than between G and E. So if we want to play chords from the D set but play in the key of E - we start with D and count the steps to E and we get 2 so we put the capo on the 2nd fret and play a D chord and it comes out as an E chord. D plus two semitones equals E.
One easy way to calculate this if you have a piano keyboard (or picture of one) handy, is to start with the key that corresponds to the chord set you want to play and start going up the piano keys until you get to the key you want to play in. The number of keys you count in order (black and white keys) ending with the key you want the song to sound in - gives you the capo position.
Or if you don't want to do all the counting, just print this chart.