In a sentence
A key signature sets the sharps or flats that normally apply throughout the music.
The number and order of sharps or flats identifies a key family and supplies default alterations. An empty signature is still meaningful: it shows zero written sharps or flats.
Major and minor keys can share a signature, so use the harmony and tonal centre as well as the symbols. A later signature explicitly resets the default pitches.