Example 6 (1999 40th IMO Problem) Determine all pairs of positive integers $(n, p)$, satisfying: $p$ is a prime, $n \leqslant 2 p$ and $(p-1)^{n}+1$ is divisible by $(1, p)$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
Analyzing: This problem is actually to prove that $(p-1)^{n} \equiv-1\left(\bmod n^{p-1}\right)$, which easily leads to the idea of using the concept of order.
Solution: When $p=2$, only the integers $n=1,2$ satisfy the condition.
Now consider the case where $p$ is an odd prime not less than 3:
In this case, $(p-1)^{n}+1$ is an odd number, so $n$ can only be an odd number. First, assume $n>1$, and let the smallest prime factor of $n$ be $q \geqslant 3$. Then $n$ can be expressed as $n=q^{k} \cdot s$, where $q \times s, k \geqslant 1, s$ is an odd number, and each prime factor of $s$ (if $s \neq 1$) is greater than $q$.
Thus, from $(p-1)^{n} \equiv-1\left(\bmod n^{p-1}\right)$, we know that $(p-1)^{n} \equiv-1(\bmod q)$.
By Fermat's Little Theorem: $(p-1)^{q^{k}} \equiv p-1(\bmod q)$, so $(p-1)^{s} \equiv-1(\bmod q)$.
Let $l$ be the order of $p-1$ modulo $q$, then $(p-1)^{l} \cong 1(\bmod q)$,
and $(p-1)^{s} \equiv-1(\bmod q), (p-1)^{2 s} \equiv 1(\bmod q)$,
$(p-1)^{q-1} \equiv 1(\bmod q)$, so $l|2 s, l| q-1, l \chi_{s}$,
so $l$ is even, and $l \mid(2 s, q-1)$.
By the choice of $q$ and $s$, so $(2 s, q-1)=2$,
so $l=2$. Therefore, $q \mid(p-1)^{2}-1$.
Since $p-1 \neq 1(\bmod q)$, so $q \mid(p-1)+1$. Therefore, $q=p$.
Thus, $p \mid n$, and since $n \leqslant 2 p$, so $n=p$ (note that $n$ is odd).
So $(p-1)^{p} \equiv-1\left(\bmod p^{p-1}\right)$.
If $p \geqslant 5$, then $p^{3} \mid p^{p-1}$, so $(p-1)^{p} \equiv-1\left(\bmod p^{3}\right)$.
$$
\text { Also, } \begin{aligned}
(p-1)^{p}+1 & =\sum_{j=3}^{p} C_{p}^{j}(-1)^{p-j} p^{j}+C_{p}^{2}(-1)^{p^{-2}} p^{2}+p^{2} \\
& \equiv p^{2}\left(\bmod p^{3}\right) .
\end{aligned}
$$

Contradiction!
So $p=3$, in this case $(n, p)=(3,3)$.
It is also easy to see that $(1, p)$ satisfies the condition.
Therefore, all solutions that satisfy the condition are $(2,2),(3,3),(1, p)$ (where $p$ is a prime number).
Comment: Setting $p$ as the smallest prime factor of $n$ is a very useful technique, which immediately gives $(p-1, n)=1$. This, combined with Fermat's Little Theorem and the concept of order, is a commonly used method in problem solving.