i) By considering $(1+x+x^2+\cdots+x^n)(1-x)$ show that, if $x\neq 1$, $$1+x+x^2+\cdots+x^n=\frac{(1-x^{n+1})}{1-x}$$
ii) By differentiating both sides and setting $x=-1$ show that $$1-2+3-4+\cdots+(-1)^{n-1}n$$
takes the value $-\frac{n}{2}$ if n is even and the value $\frac{(n+1)}{2}$ if n is odd.
For part i) I just simplified the LHS, divided by $(1-x)$ and got the desired result.
For the next part I found the derivative of both sides, and set $x=-1$ giving me:
$$1-2+3-4+\cdots+(-1)^{n-1}n = \frac{(2)(-1(n+1)(-1)^n)-(1-x^{n+1})(-1)}{4} = \frac{-2(n+1)(-1)^n+1+(-1)^{n+2}}{4}$$
However I'm not understanding the part about n being even and odd. If n is even, does this mean that $n = 2n$ and if it is odd, $n = 2n+1/2n-1$? What would be the next step?
Thanks