When a song is written using (predominantly) the F major scale the song is said to be in the key of F major. F is in this case the key note of the piece.
Obviously when using the F major scale most Bs will be Bbs.
To avoid writing this flat every time it occurs in a piece in the key of F major a flat is placed on the middle line of the staff after the Clef. This is called the key signature, and indicates that all Bs in the piece are flattened (to Bb) unless the flat is cancelled by a natural sign placed in front of an individual note.
Below two lines in the key of F major. The first one using individual flat signs, the second line using the appropriate key signature.