Roots of unity and an extremal problem I want to determine the subset of $m$ members ($m < n/2$) of the set $e^{i 2\pi k/n}, \  \ k=0,\dots, n-1$, so that the absolute value of its sum is maximal.
 A: A simple geometric argument is based on the following observation about vectors: $$|\overrightarrow{u}+\overrightarrow{v}|^2=|\overrightarrow{u}|^2+|\overrightarrow{v}|^2+2\overrightarrow{u}\cdot \overrightarrow{v},$$ where $\overrightarrow{u}\cdot \overrightarrow{v}=|\overrightarrow{u}||\overrightarrow{v}|\cos \theta$ is the dot product. To maximize the length of the sum of vectors, the angle $\theta$ has to be as small as possible. This leads to the requirement that in the sum of roots of unity, there should be no "gaps". If there is a gap (that is, if the roots of unity are not consecutive), then one can split the sum into two subsums and write it as the sum of two vectors, where they are separated by at least one root of unity. Then by the above observation, one can apply a suitable rotation to make the length of the sum greater. This is a contradiction.
In fact, by direct computation, the maximum can be achieved by taking the sum to be $v:=1+\zeta+\cdots+\zeta^{m-1}$ ($m< n/2$), where $ \zeta=e^{2\pi i/n}$. In this case, $$|v|=\frac{\sin m\pi/n}{\sin \pi/n}.$$
