Four. (50 points) Find all positive integers $n$ such that the set $S=\{1,2, \cdots, n\}$ can be partitioned into two disjoint subsets $A$ and $B$ of equal size, satisfying:
$$
\sum_{k \in A} k=\sum_{k \in B} k, \sum_{k \in A} k^{2}=\sum_{k \in B} k^{2}, \sum_{k \in A} k^{3}=\sum_{k \in B} k^{3} .
$$
$$
\begin{array}{l}
\text { Given } \sum_{k \in A} k=\frac{1}{2}(1+2+\cdots+n) \\
=\frac{n(n+1)}{4} \in \mathbf{N} \\
\Rightarrow 4|n \Rightarrow 16| n^{2} . \\
\text { Then } \sum_{k \in A} k^{3}=\frac{1}{2}\left(1^{3}+2^{3}+\cdots+n^{3}\right) \\
=\frac{n^{2}(n+1)^{2}}{8}
\end{array}
$$

is even.
Since $\sum_{k \in A} k^{3}$ and $\sum_{k \in A} k$ have the same parity, it follows that $\frac{n(n+1)}{4}$ is even, i.e., $8 \mid n$.
When $n=8$, assume there exists a partition satisfying the conditions,

Let $A=\{u, v, w, 8\}$. Then,
$$
u^{3}+v^{3}+w^{3}=136 \text {. }
$$

Thus, $u, v, w \leqslant 5$.
If $5 \in A$, then 11 is the sum of two cubes;
If $5 \notin A$, then
$$
u^{3}+v^{3}+w^{3} \leqslant 8+27+64=99
$$
When $n=16m$ for $m \geq 2$, take
$$
\begin{array}{l}
A=S \cup A_{24} \cup \cdots \cup A_{16 m-8}, \\
B=T \cup B_{24} \cup \cdots \cup B_{16 m-8}
\end{array}
$$

Thus, the required positive integer $n=8 m\left(m \in \mathbf{Z}_{+}, m \geqslant 2\right)$.