Solution (source code)

= Solution

For $k=0$, the convention $0^0=1$ gives $S_0=p\equiv0\pmod p$. Now suppose $1\leq k<p-1$ and choose a <primitive root> $g$ modulo $p$. The nonzero residues are $g^j$ for $0\leq j\leq p-2$, while the $x=0$ term vanishes. Hence
$$
S_k\equiv\sum_{j=0}^{p-2}g^{jk}\pmod p.
$$
This is a <finite geometric series>. Since $g^k\not\equiv1\pmod p$ but $g^{k(p-1)}\equiv1\pmod p$ by <Fermat's little theorem>, multiplication by the nonzero residue $g^k-1$ gives
$$
(g^k-1)S_k\equiv g^{k(p-1)}-1\equiv0\pmod p.
$$
The factor $g^k-1$ is invertible modulo the <prime number> $p$, so
$$
\boxed{S_k\equiv0\pmod p.}
$$