Showing that $\sum_{n \bmod q} \lvert \chi(n) \rvert^2 = \phi(q)$ Let $\chi$ be a primitive character mod q. 
Why do we have
$\sum_{n=1}^q | \chi(n)|^2 =\phi(q)$  ?
This might seem trivial but I am new with characters.
Thanks.
 A: A character $\chi$ takes values that are either on the unit circle (and thus of norm $1$) or $0$. As $\chi$ is primitive, we know that $\chi(n) = 0 \iff \gcd(n, q) > 1$.
So $\lvert\chi(n)\rvert^2$ is $0$ when $\gcd(n, q) > 1$ and is the magnitude, which is $1$, otherwise.
And so
$$ \sum_{1 \leq n \leq q} \lvert \chi(n) \rvert^2 = \sum_{\substack{1 \leq n \leq q \\ \gcd(n,q) = 1}} 1 = \phi(q).$$
Now, for a different point of view, without any analysis.
Recall that a character is a function from a group to the group of units in $\mathbb{C}$. For finite groups, the image is contained within the roots of unity in $\mathbb{C}$ (since these are the elements of finite order). A Dirichlet character is really a character defined on $(\mathbb{Z}/q\mathbb{Z})^\times$, and extended to $\mathbb{Z}/q\mathbb{Z}$ by being $0$ on the rest.
Then $\vert \chi^2 \rvert$ is a trivial character on $(\mathbb{Z}/q\mathbb{Z})^\times$ (since it is primitive, this is the correct group). Summing the value of $\lvert \chi^2 \rvert$ over the elements of $\mathbb{Z}/q\mathbb{Z}$ is really summing over $(\mathbb{Z}/q\mathbb{Z})^\times$ (as the character was extended to be zero on the non-units).
Since it is the trivial character on $(\mathbb{Z}/q\mathbb{Z})^\times$, this is really asking for the size of $(\mathbb{Z}/q\mathbb{Z})^\times$, which is exactly $\phi(q)$. $\diamondsuit$
