Example 7 Find all positive integers $n$ such that there exists a sequence $\left\{x_{n}\right\}$ where $1,2, \cdots, n$ each appear once and for $k=1,2, \cdots, n$ we have $k \mid x_{1}+x_{2}+\cdots+x_{n}$.
Analysis: This problem should make full use of special elements.
Solution: When $k=n$, $n \left\lvert\, \frac{n(n+1)}{2}\right.$, so $n+1$ is even, which means $n$ is odd. Let $n=2 p+1, p \in \mathbf{N}^{+}$. When $k=n-1=2 p$, $2 p \left\lvert\,\left(\frac{n(n+1)}{2}-x_{n}\right)\right.$, i.e., $2 p \mid\left((2 p+1)(p+1)-x_{n}\right)$
Thus, $2 p \mid(p+1)-x_{n}$
Also, $2 p \geqslant p+1>p+1-x_{n} \geqslant p+1-(2 p+1)=-p>-2 p$.
Therefore, $p+1-x_{n}=0$.
Thus, $x_{n}=p+1$.
Similarly, when $k=2 p-1$, $(2 p-1) \mid\left(2 p^{2}+2 p-x_{n-1}\right)$,
Thus, $(2 p-1) \mid(p+1)-x_{n-1}$
Also, $p+1>p+1-x_{n-1}>p+1-(2 p+1)=-p$.
Since $x_{n-1} \neq x_{n}=p+1$, we have $2 p-1<p+1 \Rightarrow p<2$. Also, $p \in \mathbf{N}^{+}$. Therefore, $p=1$. At this point, $x_{1}=1, x_{2}=3, x_{3}=2$ satisfy the conditions. Clearly, when $n=1$, $x_{1}=1$ satisfies the conditions.
In summary: $n=1, n=3$ are the positive integers that satisfy the conditions.