= Solution
For $n\ge1$, the zero <residue> contributes zero. Multiplication by any nonzero $\alpha$ permutes the nonzero <residues>, so the sum $S$ satisfies $S=\alpha^nS$ in $\mathbb F_p$. If $p-1\nmid n$, choose a <primitive root> $\alpha$; then $\alpha^n\ne1$, forcing $S=0$. If $p-1\mid n$, every nonzero term equals one, so $S=p-1=-1$ in the <field>.
The printed display also mentions $n=0$, although its introductory assumption is $n\ge1$. For that extra case the sum of the $p$ integer values $x^0$ for $1\le x\le p$ is $p\equiv0$, so that branch is consistent too. The result is
$$
\boxed{\sum_{x=1}^p x^n\equiv-1\pmod p\ \text{exactly when }n>0,\ (p-1)\mid n;\quad0\text{ otherwise}.}
$$
Back to article page