Proof of the identity $\left\lvert\sum_{j=0}^{p-1}e^{(2\pi i/p)(mj^2+nj)}\right\rvert=\sqrt p$ for $p$ odd prime While studying themes related to mutually unbiased bases, I've come across the following identity:
$$\left\lvert\sum_{j=0}^{p-1}e^{(2\pi i/p)(mj^2+nj)}\right\rvert=\sqrt p,$$
for $p$ odd prime and $m\neq0$.
I found this in Eq. (12) here, where it is simply reported as "a fact from number theory", citing this other paper (Link to pdf), in which the same identity is reported without reference nor proof (see top of page 3245).
I'm not a number theorist, so I do not know whether this is a very basic identity in that context. Googling for things like "formulas for sums of exponentials/phases in the context of number theory" unsurprisingly didn't give useful results.
Does this identity have a name? Where can I find a proof for it?
 A: You can show this easily using Parseval formula for functions on $\mathbb{Z}/p$.
Let $\omega = e^{2 \pi i / p}$, then by changing variables $j \mapsto j +\alpha$ we get 
$$|\sum_j \omega^{mj^2+nj}|=|\sum_j\omega^{mj^2+2mj\alpha+m\alpha^2+nj+n\alpha}|=
|\sum_j\omega^{mj^2+(2m\alpha + n)j}|$$ where the last equality follows from 
the fact that the factor $\omega^{n\alpha + m\alpha^2}$ gets out of the sum and has absolute value $1$. Since $2m\alpha + n$ run over all $\mathbb{Z}/p$ when $\alpha$ does (I assume $m \not \equiv 0 \pmod{p}$, otherwise it is of course wrong!), the value of this expression is independent of $n$. On the other hand, the expression in the absolute value is a Fourier coefficient of the function $f(j)=\omega^{mj^2}$, so by Parseval formula we have 
$p = ||f||^2 = 1/p\sum_n |\hat{f}(n)|^2 = |\hat{f}(-n)|^2$, where the last equality follows from the fact that all the Fourier coefficients have the same absolute value, as we saw already above. But the last term is just your sum, by definition. 
A: You can find a complete proof (possibly you have to do the completing-the-square step on $mj^2+nj$ yourself) in Sections 9.2–9.3 of Montgomery and Vaughan's Multiplicative Number Theory I. Classical Theory.
