5. Find all subsequences $\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}$ of the sequence $\{1,2, \cdots, n\}$, such that for $1 \leqslant i \leqslant n$, the property $i+1 \mid 2\left(a_{1}+a_{2}+\cdots+a_{j}\right)$ holds.
5. Solution: Let $a_{1}, a_{2}, \cdots, a_{n}$ be a sequence that satisfies the given conditions.

For $n>2$ we have: $n\left|2\left(a_{1}+\cdots+a_{n-1}\right)=n(n+1)-2 a_{n} \Rightarrow n\right| 2 a_{n}$.
If $n$ is odd, then $a_{n} \geqslant n$. Otherwise, $a_{n}=\frac{n}{2}$ or $n$. Let $n=2 k$, if $a_{n}=k$, then since $n-1 \mid 2\left(a_{1}+\cdots+a_{n-2}\right)$,
we have $2 k-1 \mid 2 k^{2}-a_{n-1}$, so $a_{n-1}=k=a_{n}$, which is a contradiction. Therefore, $a_{n}=n$.
Thus, $\left(a_{1}, a_{2}, \cdots, a_{n}\right)=(1,2, \cdots, n)$ or $(2,1,3,4, \cdots, n)$.