Show that $1^m+2^m+\cdots+(p^2)^m\equiv-p\pmod{p^2}$ when $p-1\nmid m$ Can you please help of how can I approach this proof. I have seen a proof of the power sum of p in the internet but it doesn't seem very helpful. I want to show that
$S_m(p^2)$ is congruent to $-p$ mod $p^2$, when $(p-1) \not | m$, where $p$ is a prime.
 A: Let us rewrite things clearly for $p>2$ and $m\geq 1$:
$$S_m(p^2)=\sum_{k=1}^{p^2} k^{m} \,\,\, (*)$$


*

*if $m=1$ :
$$S_m(p^2)=\frac{p^2(p^2+1)}{2}=0 \mod p^2$$

*Suppose $m>1$ and $p-1$ does not divide $m$ so in the sum $(*)$ we can remove all elements which are divisible by $p$, because if $p$ divides $k$ then $k^m= 0 \mod p^2$ so :
$$S_m(p^2)=\sum_{0<k<p^2,gcd(k,p)=1} k^m\mod p^2 $$


Given an element $a$ such that $gcd(a,p)=1$ the function $k \to a^mk$ is bijective so:
$$a^mS_m(p^2)=\sum_{0<k<p^2,gcd(k,p)=1} (ak)^m\mod p^2\\
=\ \ \ \ \ S_m(p^2) \mod p^2 $$
This signifies that $S_m(p^2)=0$ or $\forall a\in \mathbb{Z}_{p^2}$ $a^m=1 \mod p^2$ which contradicts $p-1$ divides $m$, so:
$$ S_m(p^2)=0 \mod p^2 $$


*

*When $p-1$ divides $m$ you can prove that :
$$ S_m(p^2)=-p \mod p^2 $$
To prove this as we mentioned already:
$$S_m(p^2)=\sum_{0<k<p^2,gcd(k,p)=1} (k)^m\mod p^2$$ 
and we know that every element $k$ such that $gcd(k,p^2)=1$ can be written as $k=ip+j$ with $0\leq i\leq p-1$ and $0< j\leq p-1$ so :
$$S_m(p^2)=\sum_{i=0}^{p-1} \sum_{j=1}^{p-1}(ip+j)^m\mod p^2$$ but we have $(ip+j)^m=j^m \mod p$ so :
$$S_m(p^2)=\sum_{i=0}^{p-1} \sum_{j=1}^{p-1}j^m\mod p^2 \\
=\ \ \sum_{i=0}^{p-1} S_m(p) \mod p^2\\
=\ \ \ pS_m(p) \mod p^2$$


now to finish we have to prove that $S_m(p)=-1 \mod p$ which is easy because $j^m=1$ ($p-1$ divide $p$) for all $0<j\leq p-1$ 
