Gauss sum for primitive real Dirichlet character If $\chi$ is a real non-trivial primitive character modulo $q\ge 1$, then how could one show that
$$\sum_{n\in \mathbb Z/q\mathbb Z} \chi(n)e\left(\frac nq\right) = \sum_{n\in \mathbb Z/q\mathbb Z} e\left(\frac {n^2}q\right) $$
where $e(z) = \exp(2\pi i z)$? I think one should be able to see this directly, but I simply cannot figure out anything useful. If $n$ is a square mod $q$, then of course $\chi(n) = 1$, so maybe that would be a good place to start... But I've been stuck for quite some time on this.
Some help would be greatly appreciated. Thank you.

You need to assume that $q$ is prime (you can check for instance that neither of the primitive characters modulo $8$ have this property). When $\chi$ is the quadratic character modulo a prime $q\ge3$, my hint is that you first verify the identity $\chi(n)=\#\{y \pmod q\colon y^2\equiv n\pmod q\}-1$, and then plug this into the left-hand side and see how it equals the right-hand side. (It's slightly easier to see if you make the index of summation on the right-hand side $y$ instead of $n$....)
