When a piece of music is written in a given key, the sharp and flat symbols of that key can be written at the beginning of the staff to save having to repeatedly write those accidental symbols before every note on the staff.
If a key signature would not be useful in simplifying the musical arrangement, it need not be used at all, in which case each sharp or flat symbol is shown before each note on the staff.
The other situations where the key signature appears to be missing is for the C major key signature and A natural minor key signature, neither of which contain any sharp or flat notes, so no symbols are shown after treble or bass clef.
The key signature is set of sharps or flats (never mixed) shown after the treble or bass clef on the musical staff.
Below is the Cb major key signature which has 7 flat notes, on the treble then bass clef.
This example is used because it shows the key signature positions of all possible notes - ie.all scale notes (from A to G) have been flattened.
The exact order and position of the key signature symbols after the clef symbol varies according to whether it is a sharp or flat-based key signature.
Flat key signatures, like the one above, use the Battle Ends And Down Goes Charles Father pattern.
For an example of this, have a look at the Cb major key signature, which describes this phrase's origin ( the circle of fourths ) in more detail.
Sharp key signatures use the Father Charles Goes Down And Ends Battle pattern.
For an example of this, have a look at the C# major key signature, which describes this phrase's, origin (the circle of fifths ) in more detail.
Bass clef notes are usually used to show notes lower in pitch / sound than treble clef notes.
On this site (only), a convention is used for all key signatures where middle C is shown with an orange line through it (you can see this on the piano diagrams too).
So on the clefs above, you can see that middle C is the first note of the treble clef and the last note of the bass clef.
Of course, it is also possible for the treble clef to shown notes lower than middle C, and for the bass clef to shown notes higher than middle C, so the diagrams above are just to demonstrate the meeting point of both clefs.
An interesting thing about the diagrams above is that the symbols are the same, except the bass clef symbols are shifted down the staff lines by one two positions (1 line + 1 space).
This means that any given note, eg. C does not sit on the same line/space position on each clef.
On the bass clef, for example, note C occupies the same space as note A does on the treble clef.
All of the rules above apply equally to major and natural minor key signatures.
And since each major scale has a relative minor scale (and vice versa), which contains the same notes, it follows that they both have the same key signature.
For major and (natural) minor scales, the key signature directly reflects the exact notes in the scale.
However, harmonic minor and melodic minor scales, borrow the key signature of the natural minor key signature (in the same key), and then show the note differences as accidentals before each note difference on the staff.