The number of sharps and flats in the key signature determines the key of a musical piece. This determination is relative to the Circle of Fifths because it annotates what sharps or flats will follow in that key. For instance, if there are no sharps or flats in the key signature it is in the key of C (because there are no sharps or flats in a C Major Key signature). To find what key a song is in, simply match the sharps or flats with those in the Circle of Fifths, and that will yield the key signature.
Transposing the key of a song is used to allow the song to be played on different instruments or to allow a singer to bring the song into their range. In order to transpose a song, you must first number the scale degrees of the composition you want to change. Then, using the pattern of tone, tone, semitone, rewrite the song in the key you wish.