So, when you play a C on the keyboard, you get the fundamental at the C frequency but also quite a few harmonics at higher frequencies, several of them being themselves C notes, but at higher octaves. The more harmonics the tone has at higher octaves and the closer those are in the harmonic series, the more stable the tone is.
Looking at the major scales (if you need a refresher course on scales, feel free to go back to the scales post):
The degree 1 note has 4 harmonics at the same degree (at higher octaves): 2nd, 4th, 8th and 16th harmonics.
The degree 2 note has 1 harmonic: 9th harmonic.
The degree 3 note has 2 harmonics: 5th and 10th harmonics.
The degree 4 note has no harmonics.
The degree 5 note has 3 harmonics: 3rd, 6th and 12th harmonics.
The degree 6 note has 1 harmonic: 13th harmonic.
The degree 7 note has 1 harmonic: 15th harmonic.
As you can see, the degree 1 note is always the most stable. Only two other notes are stable: degrees 3 and 5, with 5 being more stable than 3. All other degrees are unstable. This gives us the following stability order (from most stable to least stable): 1 5 3 6 2 4 7.
So, if you are playing in the key of C major:
the notes C (degree 1), G (degree 5) and E (degree 3) are stable and
the notes A (degree 6), D (degree 2), F (degree 4) and B (degree 7) are unstable.
What does this mean for music composers? Well, unstable notes usually need to be resolved downward, except the 7th (in the stability order) that's commonly resolved upward. Unstable tones create a sense of expectation and give melodies forward motion until they get resolved (if they do get resolved).
Looking at the stability order:
2 resolves naturally to 1,
4 resolves naturally to 3,
6 resolves naturally to 5 and
7 resolves naturally to 1 (at next higher octave).
Unstable notes don't have to resolve to their natural resolutions, they certainly can "skip" resolution levels; they don't even have to resolve at all (if you don't want to). By generating expectation in the ears of the listener, unstable tones provide "kinetic" energy to melodies.
In this video, we show how an unstable tone at the end of a melody can leave a feeling of expectation or that's something is amiss. We resolve the unstable tone (D) by downward motion to the most stable tone of all (C) and everybody is happy again.