Calculate the sum of Legendre sequence $S(x):=\displaystyle \sum_{x=0}^{p-1}\left(\dfrac{x(x+k)}{p}\right)$ with $p > 3$ prime number, $k \in \mathbb{N}$ and $\text{gcd}(p,k)=1$.
I have tried to find the solution but I did not succeed. I would appreciate if somebody could help me. Thank you.
Dropping the term corresponding to $x=0$ and making the substitution $x=ky$, we get $$ S(k) = \sum_{y=1}^{p-1} \left(\frac{ky(ky+k)}p\right) = \sum_{y=1}^{p-1} \left(\frac{y(y+1)}p\right),\quad k\ne 0. $$ This shows that the sum is independent of $k$. Consequently, $$ S(k) = \frac1{p-1}\,\sum_{k=1}^{p-1} \sum_{x=1}^{p-1} \left(\frac{x(x+k)}p\right) = \frac1{p-1}\,\sum_{x=1}^{p-1} \left(\frac xp\right)\sum_{k=1}^{p-1}\left(\frac{x+k}p\right). $$ In the inner sum in the RHS, $x+k$ runs over all elements of $\mathbb F_p$ other than $x$. As a result, the sum is equal to $-\left(\frac{x}p\right)$, leading to $$ S(k) = \frac1{p-1}\, \sum_{x=1}^{p-1} \left(\frac xp\right)\cdot\left(-\left(\frac xp\right)\right) = -1, \quad k\in\mathbb F_p^\times. $$