I have been asked the following.
Let $p$ be an odd prime. Prove the following congruence modulo $p^{2}$: $$\mathcal{S}_{m}(p^{2})=1^{m}+2^{m}+\ldots+(p^{2}-1)^{m}=\begin{cases} 0, & if\ (p-1)\nmid m,\\ -p, & if\ (p-1)\ |\ m, \end{cases}$$ for all $m\geq1$.
Hint: We are given that there exists a primitive element $g$ modulo $p^{2}$.
I have an answer which I think is correct.
Let $g$ be a primitive element modulo $p$ (which exists by the hint). So $g$ is also a primitive root modulo $p$. The sum can be split into the powers of multiples of $p$ and the others: $$\mathcal{S}_{m}(p^{2})=\sum^{p-1}_{b=0}(pb)^{m}+\sum^{p^{2}-1}_{a=1,\ p\nmid a}a^{m}\equiv p^{m}\sum^{p-1}_{b=0}b^{m}+\sum^{p^{2}-p-1}_{k=0}(g^{k})^{m} \mod{p^{2}}.$$ Where the order of $g$ is $\varphi(g)=p^{2}-p$ by Euler's Theorem. The powers of $g$, say from $g^{\varphi(p^{2})-1}$, represent all invertible classes modulo $p^{2}$, in other words, all those coprime to $p$. If $m\geq2$, then the first summation is divisible by $p^{2}$, but this holds even when $m=1$ since $$p\sum^{p-1}_{b=0}b=p\cdot\frac{p(p-1)}{2}\equiv0\mod{p}$$ because $p$ is odd. Therefore, for all $m\geq1$, $$\mathcal{S}_{m}(p^{2})\equiv\sum^{p^{2}-p-1}_{k=0}(g^{k})^{m}\mod{p^{2}}.$$
Suppose first that $(p-1)\nmid m$, then $g^{m}\not\equiv1\mod{p}$ and so $$(g^{m}-1)\cdot\mathcal{S}_{m}(p^{2})\equiv g^{m(p^{2}-p)}-1\equiv0\mod{p^{2}}$$ because $g^{p^{2}-p}=g^{\varphi(p^{2})-1}\equiv1\mod{p^{2}}$ by Euler's Theorem. Since $g^{m}\not\equiv1\mod{p^{2}}$, $\mathcal{S}_{m}(p^{2})\equiv0\mod{p^{2}}$.
Now suppose that $(p-1)\,|\,m$, then $g^{m}\equiv1+ph\mod{p^{2}}$ for some $h$. So \begin{align} \mathcal{S}_{m}(p^{2})&=\sum^{p^{2}-p-1}_{k=0}(1+ph)^{k}\equiv\sum^{p^{2}-p-1}_{k=0}(1+kph)\\ &\equiv(p^{2}-p)+ph\frac{(p^{2}-p-1)(p^{2}-p)}{2}\equiv-p\mod{p^{2}} \end{align} since $p$ is odd.