<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] Consider functions $f(x) = 1 + 2x + 3x^2 +\ldots +(n+1)x^n$ and $F(x) = 1+ x + x^2 +\ldots + x^{n+1}$. We have $F'(x) = f(x)$. On the other hand, $F(x)(x-1) = x^{n+2} -1$ which implies $F(x) = \frac{x^{n+2}-1}{x-1}$ for $x\neq 1$. From this we have $$f(x) = F'(x) = \frac{(n+2)x^{n+1}(x-1)-(x^{n+2}-1)}{(x-1)^2}$$
All you have to do is evaluate at $i$.
</s>