Consider $\Bbb Z_p= \Bbb Z/{p \Bbb Z}$ where $p$ is an odd prime.
Now denote $S_k(p)= \sum _{j=0}^{p-1} j^k$ in $\Bbb Z_p$
The problem is to prove that $S_k(p)= \begin{cases} -1, & \text{if $(p-1)\mid k$ } \\ 0, & \text{otherwise} \end{cases}$ in $\Bbb Z_p$
Now we know $\Bbb Z_p^*$ is a cyclic group of order $p-1$, so in the first case if we have $k=a(p-1)$, then $\forall j \in \Bbb Z_p^*$ we have $j^k=j^{(p-1)a}=1$. Hence $S_k(p)=p-1=-1$ in $\Bbb Z_p$
if $(p-1)$ does not divide $k$ then I am having problem. If $\gcd(p-1,k)=1$ then $S_k(p)= \sum _{j=0}^{p-1} j=p(p-1)/2=0$ in $\Bbb Z_p$
But for the other cases?? Please help and explain in details.