6. Let $p$ be an odd prime satisfying $p \equiv 1(\bmod 4)$, compute $\sum_{k=1}^{p-1}\left\{\frac{k^{2}}{p}\right\}$, where $\{x\}=x-[x],[x]$ is the greatest integer not exceeding $x$.

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
6. Notice that $(-k)^{2} \equiv (p-k)^{2} \equiv k^{2}(\bmod p)$. If $x^{2} \equiv y^{2}(\bmod p)$, where $1 \leqslant x, y \leqslant \frac{p-1}{2}$, then $(x-y)(x+y) \equiv 0(\bmod p)$. Since $1 < x+y < p$, it follows that $x=y$. This shows that $1^{2}, 2^{2}, \cdots, \left(\frac{p-1}{2}\right)^{2}$ are quadratic residues modulo $p$. Because $p \equiv 1(\bmod 4)$, by Euler's criterion $\left(\frac{-1}{p}\right) \equiv (-1)^{\frac{p-1}{2}} \equiv 1(\bmod p)$, we know that -1 is a quadratic residue modulo $p$. By $\left(\frac{-b}{p}\right) = \left(\frac{-1}{p}\right)\left(\frac{b}{p}\right)$, it follows that $b$ is a quadratic residue modulo $p$ if and only if $-b \equiv p-b(\bmod p)$ is also a quadratic residue modulo $p$. Therefore, the set $\left\{1^{2}, 2^{2}, \cdots, \left(\frac{p-1}{2}\right)^{2}\right\}$ is, modulo $p$, the set $\left\{a_{1}, p-a_{1}, a_{2}, p-a_{2}, \cdots, a_{\frac{p-1}{4}}, p-a_{\frac{p-1}{4}}\right\}$, where $1 \leqslant a_{i}, p-a_{i} < p$. We have $\left\{\frac{a_{i}}{p}\right\} + \left\{\frac{p-a_{i}}{p}\right\} = \frac{a_{i} + p - a_{i}}{p} = 1$. Thus, the desired sum is $\frac{p-1}{4}$.