How was this result on the $L^2$ norm of a sequence obtained? I read that if we define the $L^2$ norm of a function as:
$$
\|f\|_2 = \left( \frac{1}{2\pi}\int_0^{2\pi}|f(t)|^2dt \right)^{1/2}
$$
we can show that for any sequence $(a_n)_{n \geq 0}$ over $\{-1,+1\}$, we have:
$$
\sup_{\theta \in \mathbb{R}}\left|\sum_{0 \leq n < N}a_ne^{in\theta}\right|
 \geq \left\|\sum_{0 \leq n < N}a_ne^{in \theta}\right\|_2
 = \sqrt{N}
$$
Can someone help me understand how this result was obtained?
 A: It relies on the orthonormality of $\{e^{in\theta}\}_{n\in\mathbb{N}}$ in the $L^2$ space that you have. A calculation yields that
$$\begin{align*} \Big|\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|\Big|^2 
&= \frac{1}{2\pi}\int_0^{2\pi}\Big(\sum_{n=0}^{N-1}a_ne^{in\theta}\Big)\Big(\sum_{n=0}^{N-1}a_ne^{-in\theta}\Big) d\theta \\ &= \frac{1}{2\pi}\sum_{n=0}^{N-1}\int_0^{2\pi}a_n^2 d\theta + \frac{1}{2\pi}\sum_{0\leq n\not=m}^{N-1}\int_0^{2\pi}a_na_m e^{i(n-m)\theta}d\theta\end{align*}$$
Since $e^{in\theta}$ are orthogonal, then $n\not=m$ implies that $\int_0^{2\pi}e^{i(n-m)\theta}d\theta = 0$. Also, since $a_n\in\{-1,1\}$ then $a_n^{2} = 1$. This simplifies the above to
$$\begin{align*} \Big|\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|\Big|^2 
&= \frac{1}{2\pi}\sum_{n=0}^{N-1}\int_0^{2\pi}a_n^2 d\theta \\
&= \sum_{n=0}^{N-1} a_n^2 = \sum_{n=0}^{N-1} 1 = N\end{align*} $$
This gives us the equality that $\Big|\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|\Big|_2  = \sqrt{N}$.
For the inequality you need to notice that $|\sum_{n=0}^{N-1} a_ne^{in\theta}|$ is periodic and thus attains all of its values on a compact set, so there exists $\gamma$ such that $\sup_{\theta\in\mathbb{R}}|\sum_{n=0}^{N-1} a_ne^{in\theta}| =|\sum_{n=0}^{N-1} a_ne^{in\gamma}|$. It follows for any $\theta\in [0,2\pi]$ we will have that $$\begin{align*}\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big| &\leq \Big|\sum_{n=0}^{N-1} a_ne^{in\gamma}\Big|\\ 
\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|^2 &\leq \Big|\sum_{n=0}^{N-1} a_ne^{in\gamma}\Big|^2 \\
\frac{1}{2\pi}\int_0^{2\pi}\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|^2d\theta &\leq \frac{1}{2\pi}\int_0^{2\pi}\Big|\sum_{n=0}^{N-1} a_ne^{in\gamma}\Big|^2d\theta \\
\Big(\frac{1}{2\pi}\int_0^{2\pi}\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|^2d\theta\Big)^{1/2} &\leq \Big|\sum_{n=0}^{N-1} a_ne^{in\gamma}\Big| 
\end{align*}$$
The last step uses that $|\sum_{n=0}^{N-1} a_ne^{in\gamma}|$ is constant in $\theta$ an so we can pull it out of the integral. So by our choice of $\gamma$ we now have relationship
$$\sqrt{N}  = \Big|\Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|\Big|^2 \leq \sup_{\theta\in\mathbb{R}} \Big|\sum_{n=0}^{N-1} a_ne^{in\theta}\Big|$$
