I need to understand how the leading tone (7th scale degree) functions in major keys. I see that the 7th scale degree (leading tone) resolves up to the 8th (the tonic) because the leading tone is a half step below the tonic. But in descending motion from the tonic, is it okay for the 7th scale degree to resolve to the 6th (i.e. 8-7-6)?
Eh... no. Specifically: no, I would not consider that to be a violation of the rule. I don't know about what your learning resources are going to say about this, but back when I learned this stuff, that walkdown from tonic to fifth was a specifically listed exception to the leading tone "rule" in voice-leading. In general, though, leading tone tends strongly to lead upwards to tonic in that style.
Here's a PDF of some other internet person who also mentions this exception, and although not all sources explicitly list this case as an exception, think about it - it makes a lot of sense that this would happen. The whole point is that during that descending line, you're often not really in a cadential resolution. More of a harmonic motion than a movement from unresolved to resolved, if you catch my drift.
In particular situations, this 8–7–6 line in either of the outer voices is acceptable.
When harmonizing a melody with I–iii–IV, this 8–7–6 melody line is very common; see "Puff the Magic Dragon." Part of the reason this works is that the 7 here isn't really a leading tone in the same sense that it is when 7 is harmonized with V. The iii chord doesn't have as strong a tendency to resolve to I as V does, so this 7 in the soprano is comparatively weaker and can move down.
But even when the 7 in the melody is harmonized with V, it can still go down to 6 in the right circumstances. Typically this is in a deceptive cadence, where the V moves to vi instead of to I.
But this 8–7–6 line can also happen in the bass. Often it harmonizes a I–V6–vi progression, but it can harmonize others (including a pretty rare I–iii64–vi!).
And in most cases, this 8–7–6 line in either outer voice continues on to 5, but it doesn't have to.
The rule of resolving the leading tone upwards concerns the progression V-I and V7-I, vii-I, vii dim7-I (dominant-tonic). Exception: in the middle voices the leading tone may go downwards to the 5th in purpose to have a full chord. (s. example of link user 45266.)
There are other cases where we have other harmonic progressions like iii-IV, V-IV, V7/vi-vi where the 7 doesn’t have the function of a leading tone.
A melody with the line 8-7-6 is often harmonized with secondary dominants or the 7th is treated as a passing note.
I think you want to distinguish progressions that exemplify tendency tone movements from other kinds of harmonic movement and also whether the tones are real chord tones rather than embellishing tones.
Tendency tones like the following are mostly about tonic/dominant progressions...
^7 the leading tone moves up to the tonic, because the progression is
I V I.
If the progression is different and the goal isn't the tonic chord, then
^7 moves to some other degree appropriate for the chord...
^7 doesn't move up to
^1 because the chord is
IV6 and the voice with
^7 descends to
^1 is in the upper parts.
When the line isn't moving to chord tones only but instead includes embellishing tones the concern is more rhythmic rather than harmonic and the leading tone isn't playing a harmonic role...
...this progression is just
I V - it's actually an elaboration of the first two chords in the first example above. The
^7 in the bass part in m. 1 is just a passing tone, it's essential meaning is rhythmic and embellishing. The really harmonic tones of the bass are just
^7 that is the actual harmonic leading tone would be the one in the soprano in m. 2.
You can simplify all this and pretty much just use a rule of thumb that the leading tones moves like
^1 ^7 ^1 except when you have a continuous line descending like
^1 ^7 ^6 ^5. But I think it is better to step through the examples showing the differences in progressions and embellishing motion.
But in descending motion from the tonic, is it okay for the 7th scale degree to resolve to the 6th (i.e. 8-7-6)?
Not all motion is resolution. It's perfectly fine to have an 8-7-6 melody in which the 7the degree moves to the 6th, but you wouldn't normally say that the 7th degree resolves to the 6th. Either the motion from 7 to 6 is not a resolution or the 7 has temporarily lost its function as a leading tone (for example if it is the fifth of the secondary dominant of the minor submediant, that is, of V/vi).
A common way to harmonize that melody, in fact, is I-V-vi, as in Pachelbel's Canon, where the second cycle of the canon has 8-7-6 (against the next voice playing the first cycle's 3-2-1).