A scale is a series of notes by which a musician goes in a certain order using whole steps and half steps. Scales are best explained using a keyboard:
Almost all white keys are whole steps with two exceptions; the interval between B and C as well as the interval between E and F. Each Major Scale follows the pattern of whole, whole, half, whole, whole, whole, and half.
An example would be the F Major Scale. Let's start with the furthermost white key to the right, which is F. Using the formula given to us, we go one whole step up, which is G or the next white key up. We continue the pattern that was given to us until we get something like this: F, G, A, Bb, C, D, E, F
This follows the basic pattern of major scales.
A relative minor scale is a scale where the 3rd note of the major scale is placed down a half-step . There is a certain way to get the relative minor scale:
Let's start at C as an example
Steps:
The harmonic minor scale is similar to that of a relative minor scale, only there is a slight difference. The 7th degree of the scale is raised up a half step.
Let's go back to A minor and count up scale degrees
As we count up to the seventh scale degree, G is our answer. So we raise that scale degree a half-step. You now have the harmonic minor scale of A:
A, B, C, D, E, F, G#, A
The melodic minor scale is similar to that of a harmonic minor scale, only there is another slight difference. The 6th degree of the scale is raised up a half step AND the 7th degree of the scale is also raised up a half-step when going up the scale. When going down the scale, the melodic minor is played similarly to the relative minor scale or sometimes called the natural minor scale.
Again, let's go back to A minor and count up scale degrees
As we count up to the 6th scale degree, F is our answer. G is our 7th scale degree too. So we raise both scale degrees a half-step as we ascend:
A, B, C, D, E, F#, G#, A
Now, we go descend using the natural minor scale:
A, G, F, E, D, C, B, A
Essentially, given the formula for major and minor scales, it can be fairly easy to determine the key signature. It is just a matter of finding out whether a piece is major or minor. Here is a basic cheat sheet, but it is best to know your scales by heart so that key signatures just fall into place naturally.