It can be seen that each key signature is a shorthand representation of the scale, showing only the sharps or flats which occur in that scale. Where an additional sharp or flat occurs, it is not included as part of the key signature, but is written in the music, e.g., in the key of G, if a D# note occurs, the sharp sign will be written immediately before the D note, not at the beginning of the line as part of the key signature.
To determine whether a song is in a major key or the relative minor key, look at the last note or chord of the song. Songs often finish on the root note or the root chord. E.g., if the key signature contained one sharp, and the last chord of the song was Em, the key would probably be E minor, not G major.