At the beginning of every piece of music, a key signature is located in the space directly after the clef signs. In this space the composer informs the musician which notes will be sharp or flat throughout the piece.
For example, if one sharp is in the key signature, all the F's throughout the piece are to be sharped. Notice that sharps are marking the F lines for both treble and bass.
If one flat is in the key signature all the B's throughout the piece are to be flatted. Notice that flats are marking the B lines for both treble and bass.
If there are no flats or sharps in the key signature, the piece is written in the key of C, which has no flats or sharps.
To understand the 'whys' of key signature, a musician will need to learn about scales.
How to Read Music
The logic of reading and writing music is easy for students of all ages to comprehend using the Read Music Method.