The way to tell what the key signature is in a piece of music is to look at the number of sharps. You go to the last sharp in the key signature and go to the line or space after the last sharp, and that would be the key you were playing in.
The way to tell what the key signature is in a piece of music is to look at the number of flats. You go to the last flat in the key signature. You go to the flat before the last flat and that would be the key you were playing in.
Black lines and White spaces
The lines E-G-B-D-F. Count the lines from the bottom of the staff to the top.
The spaces are F-A-C-E. Count the spaces from the bottom of the staff to the top.
The sign at the beginning of the staff, indicating which notes are represented by which lines and spaces. A symbol indicating that the second line from the bottom of a staff represents the pitch G above middle C. Also called the G Clef