Let $p$ be an odd prime. Let $\mathbb Z_p$ be the ring of integers from $0$ to $p-1$, i.e. $\mathbb Z_p=\left\{0,1,\dots,p-1\right\}$. Let $r$ be a positive integer. Then, for all values of $p$, is the following sum equals to 1?
$$\sum_{x \in \mathbb Z_p}e^{\pi irx^2/p}$$
I have shown it is true for $p=3,5$.
In addition, does it make any difference for the answer that if we know $r$ is even or odd?
Thanks in advance.