This is essentially @Alexander Geldhof ideas.
We need to deal with the case when $n$ is odd and the sum $\sum_{i=1}^n i=\frac{n(n+1)}{2}$ being even. Note that these two conditions are equivalent to say that $n\equiv 3\mod 4$.
So, we need to prove the proposition for $n\equiv 3\mod 4$. Let's do it by induction.
Initial case $n=3$: Easily we can split $A=\{1,2\}$ $B=\{3\}$.
Inductive step $n\to n+4$:
Suppose we can split the set $\{1,\dots,n\} $ into two sets $A$,$B$ with the same sum. Then, we can split $\{1,\dots,n+4\}$ into the sets $A\cup \{n+1,n+4\}$ and $B\cup\{n+2,n+3\}$ note that these sets will remain with the same sum since $(n+1)+(n+4)=(n+2)+(n+3)$.
So the induction is complete.
Remark: In the case when $n$ is even and $\sum_{i=1}^ni$ is even, we conclude $n\equiv 0\mod 4$. The induction works as well with the initial case $n=4$, $A=\{1,4\}$, $B=\{2,3\}$.