<s>[INST] $S=1+2i+3i^2+4i^3+\dots+(n+1)i^n$; $4\mid n$; closed form for $S$ $$S=1+2i+3i^2+4i^3+\dots+(n+1)i^n$$
where $4\mid n$. How can I simplify this exprerssion so as to obtain a general expression?
 [/INST] Let $n=4m$.
$$\begin{align}
S&=\boxed{\begin{array}
&\;\;\;\;1&+2i&+3i^2&+4i^3\\
+5i^4&+6i^5&+7i^6&+8i^7\\
+\vdots\\
+(4m-3)i^{4m-4}&+(4m-2)i^{4m-3}&-(4m-1)i^{4m-2}&+4mi^{4m-1}\\
+(4m+1)i^{4m}\\
\end{array}}\\\\
&=\boxed{\begin{array}
&\;\;\;1&+2i&-3&-4i\\
+5&+6i&-7&-8i\\
+\vdots\\
+(4m-3)&+(4m-2)i&-(4m-1)&-4mi\\
+(4m+1)\\
\end{array}}\\\\
&=\;\;\;\;\;\;[1-3+5-7+\cdots+(4m-3)-(4m-1)]\\
&\;\;\;\;+i\;[2-4+6-8+\cdots +(4m-2)-4m]\\
&\;\;\;\;\;\;\;\;\;+(4m+1)\\
&=[\overbrace{-2-2-\cdots-2}^m]+i[\overbrace{-2-2\cdots-2}^m]+(4m+1)\\
&=-2m+i(-2m)+(4m+1)\\
&=2m+1-i2m\\
&=\left(\frac n2+1\right)-i\frac n2
\end{align}$$
</s>