【Example 5】There are $n$ people standing in a circle, among them are $A$ and $B$, with exactly $r$ people standing between them $\left(r<\frac{n}{2}-1\right)$. How many ways are there to arrange them?
Consider first that there are $n$ fixed positions distributed along the circumference. $A$ can be arranged in any of these positions, hence there are $n$ different cases. Next, arrange $B$: $B$ can stand $r$ positions away from $A$ in a clockwise direction, or $r$ positions away in a counterclockwise direction, so in general, there are two ways to place $B$ (when $n=2 r+2$, these two ways coincide). Then, arrange the remaining $n-2$ people, which can be done in $(n-2)$! different ways. Therefore, there are $2 n(n-2)$! different arrangements in total. However, since there are no $n$ fixed positions on the circumference, and people only consider the relative order when arranging, we should consider the circular arrangement, so we have
$$
\frac{2 n \cdot(n-2)!}{n}=2(n-2)!
$$

different ways to arrange them.