Nondegenerate quadratic form $Q$ in $n$ variables with coefficients in $F_p$, cardinality of $\{x \in (\mathbb{F}_p)^n : Q(x) = 0\}$

There is a book on algebraic number theory I am reading that shows the following theorem.

Let $Q$ be a nondegenerate quadratic form in $n$ variables with coefficients in $F_p$ ($p \neq 2$). Then$$\text{Card}\{x \in (\textbf{F}_p)^n : Q(x) = 0\} = p^{n-1} + \epsilon(p-1)p^{{n\over{p}} - 1},$$where$$\epsilon = \begin{cases} 0 & \text{ if }n \text{ is odd,} \\ \left({{(-1)^{n\over2} D_Q}\over{p}}\right) & \text{ if }n \text{ is even.}\end{cases}$$

In the proof, there is the assertion that$$pN = \sum_{a = 0}^{p-1} \sum_{x \in \textbf{F}_p^n} \text{exp}\left({{2\pi iaQ(x)}\over{p}}\right),$$where $N$ is the cardinality in the statement of the theorem. I do not see why this equality is true. Could someone help me?

EDIT: Someone had linked me a proof, but again, that proof does not clarify the step I have pointed out as not understanding...


Solution 1:

The key point is that for any $y$:

$\sum_{a=0}^{p-1}\exp\left( \frac{ 2\pi i y}{p}\right)=\begin{cases} p & \text{ if }y=0 \\ 0 & \text{ if }y \neq 0\end{cases}$

Simply switch the order of summation and plug that in.

This identity follows summing a geometric series.