I’m reading Davenport’s Multiplicative Number Theory and I’m currently in the second chapter, the subject of which is calculating the following sum:
$$ G= \sum_{n=1}^{q-1} \Bigr(\frac{n}{q}\Bigr )e_q(n) $$
Where $q$ is an odd prime, and $e_q(n)=e^{2\pi in/q}$. On page 13, he does the following manipulation:
$$ G=\sum_{R \text{ q.r.}} e_q(R)-\sum_{N\text{ q.n.r.}} e_q(N)=1+2\sum_{R \text{ q.r.}} e_q(R) $$
Where $r$ is a quadratic residue mod $q$ and $n$ is a quadratic non-residue mod $q$.
While I understand the first separation from one sum to two sums based on whether or not we have a quadratic residue, I cannot understand how we merge this back into one sum involving only quadratic residues, nor do I understand where the mysterious $1$ comes from.
Can anyone provide a proof of this equality?
In your notation, $$\sum_{R\text{ q.r.}}e_q(R)+\sum_{N\text{ q.n.r.}}e_q(N)=\sum_{n=1}^{q-1}e_q(n)=-1$$ (the last equality is "a sum of roots of unity", or "a sum of a geometric progression").