Generalizing a sequence.
If you want $m$ negatives ones, followed by $m$ positive ones, et cetera, then use $$-(-1)^{\lfloor{n/m}\rfloor}$$ where $\lfloor{x}\rfloor$ is the floor function, and the sequence starts with $n=0$. Happy New Year!
How about $x(k)=(-1)^{\left\lceil\frac{k}{n}\right\rceil}, k=1,2,3\ldots$? This will produce the sequence with $n$ of $-1$'s, followed by $n$ of $1$'s, followed by $n$ of $-1$'s etc.
Note: $\lceil x\rceil$ is $\operatorname{ceil}(x)$ - the smallest integer $\ge x$.
Try this:
$$x(k)=-\frac{2}{\pi}\left[\arctan\left(\sin\frac{(2k-1)\pi}{2n}\right)+\arctan\left(\csc\frac{(2k-1)\pi}{2n}\right)\right]$$
for $k=1,2,3,\ldots$. Took me a bit of time to craft it, but it should work.