Example 3 (1990 National Training Team Training Question) Find all positive integers $M$ less than 10 such that 5 divides
$$
1989^{M}+M^{1989} .
$$
Consider mod 5.
$$
1989^{M} \equiv(-1)^{M}(\bmod 5) \text {. }
$$

If $M=5$, then $M^{1989}=5^{1989} \equiv 0(\bmod 5), 1989^{M}=1989^{5} \equiv-1(\bmod 5)$, then $5 \times 1989^{M}+M^{1989}$.
Thus $M \neq 5$.
By Fermat's Little Theorem, 5 is a prime, and $M \neq 5$ and $1 \leqslant M \leqslant 9$, then $(5, M)=1$, so $M^{1989} \equiv M(\bmod 5)$.
If $M$ is odd, then $5 \mid M-1$, hence $M=1$.
If $M$ is even, then $5 \mid M+1$, hence $M=4$.
Therefore, $M=1$ or 4.