Example 7 Find all pairs of positive integers $(p, n)$ satisfying:
(1) $p$ is a prime; (2) $n \leqslant 2 p$; (3) $n^{p-1} \mid (p-$ $1)^{n}+1$.

保留了原文的换行和格式。
Proof: Method 1: Clearly, $(p, 1)$ and $(2,2)$ are pairs of positive integers that satisfy the problem, now assume $n \geqslant 2, p \geqslant 3$.
$\because(p-1)^{n}+1$ is an odd number, $\therefore n$ is an odd number and $n<2p$, let $q$ be the smallest prime factor of $n$, then $q \mid(p-1)^{n}+1$, i.e., $(p-1)^{n} \equiv-1(\bmod q)$, and $(q, p-1)=1,(n, q-1)=1$, there exist $u, v \in \mathbf{Z}$ such that $u n+v(q-1)=1$, by Fermat's Little Theorem we get: $p-1 \equiv(p-1)^{n u}(p-1)^{u q-1)} \equiv(-1)^{u}(\bmod q), \because q$ is an odd number,
$\therefore u$ must be an odd number, $p-1 \equiv-1(\bmod q)$, thus $p=q$,
$\because n<2p=2q$ and $q$ is the smallest prime factor of $n$,
$$
\begin{array}{l}
\therefore n=p=q . \\
\because(p-1)^{p}+1=p^{p}-\mathrm{C}_{p}^{1} p^{p-1}+\cdots+ \\
\mathrm{C}_{p}^{p-1} p,
\end{array}
$$
$$
\therefore p^{p-1} \mid(p-1)^{p}+1 \Leftrightarrow p \leqslant 3, \therefore p=3 \text {, satisfies }
$$

All the pairs of positive integers that satisfy the problem are $(p, 1),(2,2),(3, 3)$, where $p$ is any prime number.

Method 2: For any prime $p$, the pair $(p, 1)$ is a solution; when $p=2$, the only pairs that are solutions are $(2,1),(2,2)$; now assume $p \geqslant 3, n \geqslant 2$, if $(p, n)$ is a solution, then $n$ is an odd number, let the smallest prime factor of $n$ be $q, n=q^{d} m(q \nmid m)$, then $(p-1)^{q} \equiv(p-1)(\bmod q)$,
$$
\begin{array}{l}
\therefore(p-1)^{q} \equiv(p-1)(\bmod q) . \\
\because q \mid(p-1)^{n}+1, \therefore(p-1)^{q^{m}} \equiv(p-1)^{n} \\
\equiv(p-1)^{m} \equiv-1(\bmod q), \\
\because(p-1)^{2 m} \equiv 1(\bmod q), \therefore q \mid(p-1)^{2 m}- \\
1, \because(p-1)^{q-1} \equiv 1(\bmod q), \\
\therefore q \mid(p-1)^{q-1}-1, \because q \text { is the smallest prime factor of } \\
n, \therefore(2 m, q-1)=2,
\end{array}
$$

Let the order of $p-1$ modulo $q$ be $r$, then $r|2 m, r| q-1$,
$$
\begin{array}{c}
\therefore r=2, \therefore q \mid(p-1)^{2}-1=p(p-2), \\
\because(m, q-1)=1, \text { if } q \mid p-2, \text { then } q \mid(p- \\
1)^{m}+1=[(p-2)+1]^{m}+1=(p-2)^{m}+\cdots+
\end{array}
$$
$m(p-2)+2 \Rightarrow q \mid 2$, which contradicts $n$ being an odd number, $\therefore q \mid p$, thus $q=p$.
$$
\because n=q^{d} m=p^{d} m<2 p=2 q, \therefore n=q=p,
$$

Also from (3) we get $p^{p-1} \left\lvert\,(p-1)^{p}+1=\frac{p-1}{2} p^{p-1}-\cdots\right.$ $+p^{2}$, the expansion has only 4 terms, $\therefore n=p=3$. Therefore, all the pairs of positive integers that satisfy the conditions are $(p, n)=(p, 1), (2,2), (3,3)$.