<s>[INST] What is the value of $1 -\omega^h + \omega^{2h} -...+(-1)^{n-1} \omega^{(n-1)h}$ when $\omega$ is a root of unity? I'm reading Ahlfors' complex analysis book. One of the problems in the book says as follows

What is the value of $1 -\omega^h + \omega^{2h} -...+(-1)^{n-1} \omega^{(n-1)h}$?

where $h$ is some integer and $ \omega = \cos\left(\frac{2\pi}{n}\right) + i \sin \left(\frac{2 \pi}{n}\right)$, for some fixed $n \in \mathbb{N}$, is one of the $n$-th roots of unity.

The first thing I noticed is that I could write the series in terms of $-\omega^h$ as
$$
1 +\left(-\omega^h\right) + \left(-\omega^h\right)^2 +...+\left(-\omega^h\right)^{n-1}
$$
Inspired by this, I separated the problem into 2 cases

*

*If $h$ is an integer of the form $ h = \frac{n(2k+1)}{2}$ for some $k \in \mathbb{Z}$, then I get the following
$$
-\omega^h = -\cos\left(\frac{2\pi}{n}h\right) - i \sin \left(\frac{2 \pi}{n}h\right)= -\cos\left(\pi + 2\pi k\right) - i \sin \left(\pi + 2\pi k\right) = 1
$$
which means the sum evaluates to $\sum_{j=0}^{n-1} 1 = n$.

*If $-\omega^h \neq 1$, then using the fact that the sum in question is a sum of the first $n$ terms in a geometric series, I can write $$
1 -\omega^h + \omega^{2h} -...+(-1)^n \omega^{(n-1)h} = \frac{1 - \left(-\omega^h\right)^n}{1 - \left(-\omega^h\right)} = \frac{1 - (-1)^n\omega^{nh}}{1 +\omega^h} 
$$
and since $h$ is an integer, I see that
$$
\omega^{nh} = \cos\left(\frac{2\pi}{n}nh\right) + i \sin \left(\frac{2 \pi}{n}nh\right) = \cos\left(2\pi h\right) + i \sin \left(2\pi h\right) = 1
$$
which means the sum simplifies to $\frac{1 - (-1)^n}{1 +\omega^h}$. From here I see that if $n$ is odd the sum will become $0$ because of the numerator, but for the case of $n$ being an even number, I don't see a way to simplify $\frac{2}{1 +\omega^h}$ more than it already is.

Is my solution correct? And if so, is this as simplified as I can write the solution, or can it still be simplified further? Thank you very much!
 [/INST] A bit late of an answer, but I think there is a simpler form for the even case (provided I haven't made any mistakes).
Startig with the form $\frac{2}{1+\omega^h}$, we begin with the usual fare of multiplying on top and bottom by the conjugate, leaving us with
$$\frac{2(1+\bar{\omega}^h)}{1+\omega^h + \bar{\omega}^h + |\omega|^{2h}} = \frac{2(1+\bar{\omega}^h)}{1+\omega^h + \bar{\omega}^h + 1^{2h}} = \frac{2(1+\bar{\omega}^h)}{2 + 2\operatorname{Re}(\omega^h)} = \frac{1+\bar{\omega}^h}{1+\operatorname{Re}(\omega^h)}.$$
Now, reintroducing the trigonometric form, $\omega = \cos(\frac{2\pi}{n}) + i\sin(\frac{2\pi}{n})$, this becomes
$$\frac{1+\cos(\frac{2\pi h}{n}) + i\sin(\frac{2\pi h}{n})}{1+\cos(\frac{2\pi h}{n})} = 1 + i\left(\frac{\sin(\frac{2\pi h}{n})}{1+\cos(\frac{2\pi h}{n})}\right).$$
Using the identities $1+\cos(2\theta) = 2\cos^2(\theta)$ and $\sin(2\theta) = 2\sin(\theta)\cos(\theta)$, we get
$$\frac{\sin(\frac{2\pi h}{n})}{1+\cos(\frac{2\pi h}{n})} = \frac{2\sin(\frac{\pi h}{n})\cos(\frac{\pi h}{n})}{2\cos^2(\frac{\pi h}{n})} = \frac{\sin(\frac{\pi h}{n})}{\cos(\frac{\pi h}{n})} = \tan\left(\frac{\pi h}{n}\right).$$
And, so the expression for the whole sum becomes
$$1 + i\tan\left(\frac{\pi h}{n}\right).$$
</s>