This is a method (excluding the Circle of Fifths) often unused to find the alterations in a certain key (although they do share the same basic principles).
This method of finding keys is somewhat underrated, taking into account the Circle of Fifths is very popular. However, in my opinion it's more effective, since it avoids too many memorizations and helps you learn key signatures better. Basicly, this method (can't remember the name, if it has one) is used to find the alterations in a key knowing the name of this one, or finding the name of the key knowing the alterations (which is done by reversing the method).
First, you need to know how alterations are found in each key (which is usually already explained in the Circle of Fifths). The order of alterations which are found in each key is FCGDAEB for sharps and BEADEGC for flats:
Notice how for sharps the alterations are a fifth apart, and for flats a fourth apart? This has to do mostly with how the major and minor scales (the ones in which the keys are "based") are formed: via tetrachords.
Tetrachords are basicly what the name says, "four" "strings". These "strings" in ancient times (often harp-like instruments) were supposed to be contiguous or in a sequence. Basicly it is a succession of four consecutive notes which form a perfect fourth. At least this definition applies to the classic "diatonic" tetrachord, in which the succesion of notes is done diatonicly (each note has a different name than the last one), and has 2 tones and 1 semitone. There are different tetrachords, but we are keeping the major one for now (with a WWH formula).
The major scale is formed by 2 tetrachords separated by 1 tone, an inferior and a superior one, which spans an octave. This differs from other scales, in which the tetrachords are different (as long as they spawn a perfect four), since the intervals are different. Also, the formation of other scales is different from the major scale, since the tetrachords may not be separated by 1 tone (disjunt tetrachords) and instead the tetrachords may share a note (conjunt tetrachords). The inferior tetrachord in the scale of Cmajor is C D E F and the superior one is G A B C instance. There are no alterations in this case, because the WWHWWWH formula applies perfectly without the need to use alterations (this is why some times Cmajor is called the "mother" of all scales, or some other similar name).
The way in which the scales are formed is by transposing the superior/inferior tetrachord of one scale and use it as the inferior/superior tetrachord of another scale. If we try in the case of Cmajor, we transpose G A B C (superior tetrachord) to make it seem as if it were an inferior one, and then we complete the new superior tetrachord: G A B C - D E F G
But in this case the WWHWWWH formula doesn't apply, because between E and F (6th and 7th degree of the Gmajor scale) there is a semitone, when in fact it should be a whole tone or step. So the only way for the formula to be correct is by altering the F, and making it F# (the sharp # makes it go 1 semitone higher). If you transpose the new superior tetrachord (D E F# G) again, you get the Dmajor scale. In that case the tetrachords go like this: D E F# G - A B C D. Again, between the 6th and 7th degree (B and C) there is a halftone, so you have to alter C to make the major scale formula apply, so you get C#. Now the scale is D E F# A B C# D, meaning there is a new alteration, but the previous ones still apply (F# in this case) because those alterations are carried with the tetrachord transposed. But if you take the example of F# major (scale being F# G# A# B C# D# E# F#) and you transpose the tetrachord C# D# E# F# to make the C#major scale, you get C# D# E# F# - G A B C# , and the alterations in A and G are missing. In this case, you use the WWHWWWH formula again to find the 3 alterations A# G# and B# , but you don't need to do it in practise since you already have those two alterations from the previous scale.
If you noticed, when you transpose the superior tetrachord, what you are doing is going up a fifth (from C to G for instance). And if you noticed, the alteration is done to the 7th grade of the new scale (F in this case). That means that the alterations are succeded in fifths, as so are the scales.
But why are flat alterations succeded in fourths? It is because the scale formation is done in reverse, with transposing the inferior tetrachord and making it a the superior of the next scale. If you take Cmaj (since it is the "mother" scale, the one without alterations) the scale is C D E F - G A B C, so you transpose C D E F and make it the superior tetrachord of a new scale. This scale is X X X X C D E F. Since scales have succesive degrees, you complete the scale going down from C, so it finally is F G A B - C D E F.
Now we do the WWHWWWH thing again, and we alter again. You would notice that you have to alter B (4th degree of the scale), but not with a sharp (which makes the note 1 semitone higher) but with a flat (which makes the note 1 semitone lower), and you end with Bb. In the case of scales with flat alterations, since you transpose the inferior tetrachord, what you are doing is going up a 4th. And since the alterations are always done to the 4th degree of the scale, the alterations also go up a fourth, hence why it is BEADGCF.
Now we can make some conclusions about this:
In a major scale with sharps, the degree altered is always the 7th, and we already have the order in which the alterations succeed, that means that if you go down one degree from the name of the scale, you find the last alteration and by the FCGDAEB formula you find the other ones.
In a major scale with flats, the degree altered is always the 4th, and we already have the order in which the alterations succeed, so that means that if you go up 3 degrees from the name of the scale you find the last alteration and by the BEADGCF formula you find the other ones. But look, didn't we agree that the flat alterations were succeeded in 4ths? Wouldn't that mean that since we go up a 4th from the name of the scale to the alteration, that the name of the scale would be in a previous position in BEADGCF? So we conclude that to find the last alteration we go forward a position in BEDCGF taking the name of the scale as starting point.
The process of scale formation is exactly the same as with major scales (mostly it is exactly the same with almost all scales), but the only thing is that the formula which dictates how the degrees are distanced from each other is different. The formula is WHWWHWW, so that means the tetrachords are different (instead of a major inferior tetrachord it is a minor tetrachord).
But let's see where the alterations take place: First we start with the relative minor of Cmajor, which is Aminor (since it has no alterations, it is the scale we start with). Now we use the sharp method, transposing the superior tetrachord. In this case, the Aminor scale is A B C D - E F G A, and the new scale would be E F G A - B C D E, it is Eminor. Because of WHWWHWW we have to alter F so it is F#(Eminor is the relative minor of Gmajor, so they share the same alterations). This means we alter the 2nd degree.
If we use the flat method (transposing the inferior tetrachord), we start with Aminor: A B C D - E F G A, and we end up with Dminor: D E F G - A B C D. We use WHWWHWW again, and so we alter B so it becomes Bb (Dminor is the relative minor of Fmaj so they share the same alterations). In this case we alter the 6th degree of the scale.
Now we can reach other conclusions as well:
In a minor scale with sharps, the degree altered is the 2nd one, so that means that to find the last alteration we go up 1 degree from the name of the scale, and by using FCGDAEB we find the other alterations.
In a minor scale with flats, the degree altered is the 6th one, so that means that to find the last alteration we go down 2 degrees from the name of the scale, and by using BEADCF we fin the other alterations.
In a major scale with sharps we go down 1 degree from the name of the scale and we find the last alteration in the FCGDAEB sequence.
In a major scale with flats we go forward one position in the BEADGCF sequence taking the name of the scale as starting point to find the last alteration of said sequence (Fmajor is an exception, but this scale can easily be memorised).
In a minor scale with sharps we go up 1 degree from the name of the scale to find the last alteration in the FCGDAEB sequence.
In a minor scale with flats we go down 2 degrees from the name of the scale to find the last alteration in the BEADGCF sequence.
One thing to take into account is that to find the alterations in a scale, one has to classify said scale in the first place. If you don't know if the alterations in a certain scale are sharp or flat, you can't use these methods, so you have to find a method to find in which group the scale falls into:
If the name of a scale already contains a sharp or flat (C#major or Bbmajor) it is obvious to which group they fall into.
If the name of a scale doesn't contain alterations, and the scale is major (Emajor or Gmajor), then the alterations in said scale are sharp unless it is Fmaj.
If the name of a scale doesn't contain alterations, and the scale is minor (Fminor, or Gminor), then the alterations in said scale are flat unless it is either Bmin or Emin.
I find this method very useful, since it relies in few memorizations (only the sequence of alterations and the classification of scales) and it helps visualizing the key signatures better, and I would say it is somewhat easier than the Circle of Fifths.