It is called a Key Signature. It aims to tell what the scale is and where the accidentals lie. In this case, we have the key with one flat, a Bb. This means we are in F Major. Roughly speaking a Key Signature is the way we notate the key. A key is the what particular major or minor scale we are in.

Though the tonality does not always adhere to the Key Signature it gives us a good way to devise the key in which the piece starts. The use of further accidentals would then tell us if the piece modulates or even if it not a Major scale at all but some variant of the minor scale.

You can consider the Key Signature as the Musical form of a book. It gives us the framework whereby music can be notated in a manner that is at least in the west, universal.