Books and articles I've read on learning key signatures seem to focus on mnemonics that tell you how many sharps or flats the key has, but I don't understand how knowing B Major has 5 sharps helps you to play in B Major - don't you still need to know which sharps?
The sharps and flats are always "added" in a particular order. So, if you know how many there should be for a key, you can work out what they are. The mnemonics you refer to can help you to remember the order sharps and flats are added in.
To be honest, though, I tell music pupils of mine, that learning key-signatures by using mnemonics is only partially helpful. Eventually most musicians will just know all of the key-signatures. So, another way to learn them, is in the same way you learn individual facts. You could learn them in the same way you learn, say, the capital cities of countries (the capital of Peru is Lima; the capital of "this" is "that"); no mnemonics are going to help you with that.
And so on, up to 7 sharps (C# Major) and 7 flats (Cb Major). (Of course, there is no need for these to be learned in a week! I could have said, Week 1: learn… Week 2: learn…)
There are, of course, patterns and rules for the sharps and flats used in different key-signatures, but if you have learnt the key-signatures, you can then look for and understand these patterns and rules.
BTW, I am certainly not advocating learning by rote without understanding. But this approach comes from experience. Often I have tried to explain the cycle of fifths and how you can work out key-signatures, to pupils just starting to learn music theory, and then realised that it is easier for them to learn a few key-signatures first, and then apply the rules later, to help them learn the rest.
Yes, the rules and patterns are important, but eventually a musician needs to know key-signatures without having to recite a mnemonic, so why not learn them this way to start with? Another similar example of learning aspects of music is the mnemonics for learning the notes on the stave (eg. Every Good Boy Deserves Fruit). This might be useful when you are just getting started, but it makes sight-reading very slow!
As a reference, this is the list of major key-signatures:
And, of course, each major key has a relative minor key, which shares its key-signature. You can easily work out the relative minor of any major key; the relative minor is a minor-third (three semitones) lower than its relative major key:
(Again, the same enharmonic relationships exist as for major keys.)
Finally, rather than using mnemonics, you can combine the "factual-learning" and "pattern-learning" approaches:
The order for adding sharps is: F# C# G# D# A# E# B#
The order for adding flats is the same reversed: Bb Eb Ab Db Gb Cb Fb
Learn the key-signatures as "facts". Learn patterns within the key-signatures as "facts". Only use the mnemonics (if you really need to) to get you started...
For me personally, I play bass guitar. Sight reading with guitar and bass (and other similar stringed instruments) can be really tricky because we have so many places on the instrument to play the same note. Being able to see two flats at the beginning of the piece and quickly say to myself "Ok - key of Bb. Bb and Eb" allows me to find my position and get going without too much thought.
Knowing exactly how many isn't the important part, since the accidentals are always in the same order according to the circle of fifths/fourths. Seeing the consistent marking of two flats, or 4 sharps, and knowing what they represent immediately is what helps quick understanding and successful reading. (Hope that made sense, there).
Because the sharps and flats always come in the same order: F#, C#, G#, D#, A#, E# and B#, in that order. The flats are exactly the opposite: Bb, Eb, Ab, Db, Gb, Cb, Fb. So, if you know there are five sharps, then you also know that those five sharps must be F, C, G, D, and A.
Speaking of mnemonics, the order of sharps and flats can be memorized with the invertible sentence:
Father Charles Goes Down And Ends Battle
for sharps, and:
Battle Ends And Down Goes Charles' Father
For some instruments, say chromatic percussion, it is helpful to know if a key has odd or even number of sharps/flats, since it could help with working out the sticking, because, with two hands, if a key has even number of sharps/flats, the cross-sticking (or the lack of) is symmetrical in the lower and upper part of the scale.