The key signature simply put tells you what notes to sharpen and flatten in a peace of music. It sets the tonality. To the left I have a standard stave to show what note each line and space represents. Below that is tablature of the same notes. Bottom right you will find the graphical representations used in standard music to indicate a key.
In any given key all the notes in it are related to first note in the scale (the tonic) . Don't forget the key signature is what tells you which chords to use also. Ok. here is how it works. If you play something in a certain key it has a set number of sharps and flats in it. The key signature tells you what notes need to be sharp or flat . For example if you were playing the scale of C major that is tabbed at the top of this page it would have no sharps or flats in it. But if you wanted to play the key of G major you would have to have a sharp in it. If you look to the right at the stave with the G beside it you will see that there is sharp (#) on the F this would tell you that you need to sharpen the F in the major scale to turn it into the key of G. So to switch from the key of c to the key of G in the tab above you would play the two F notes sharp by raising them one fret. As you move along in order for the other scales you just add one sharp to each as you go. The reason they are not in alphabetical order is this.
If you start with the key of C and start counting on
the first note of the key (C) and count up five you arrive at G this is the
beginning note of the next key. Then you sharpen the seventh note of
the new key . The seventh note in the key of G is F so you would sharpen
the F. Now count up five notes from G you come to D the next scale would
then be D. Now count up seven notes from d and you get C you would
then sharpen the C. So in the key of D there are two sharps the F#
and th C#. Then count five notes from D you get to A . Any way you get the