Prove that $\sum_{n = 1}^{p - 1} n^{p - 1} \equiv (p - 1)! + p \pmod {p^2}$ with $p$ being an odd prime First, I have to admit that I have already asked the same question on MSE several days ago. If I am bending any rules, I apologize for that and moderator can delete or close this question without warning. The problem has received a number of upvotes on MSE but with no suggestions or hints provided from the community. 
I need to prove the following:

$$\sum_{n = 1}^{p - 1} n^{p - 1} \equiv (p - 1)! + p \pmod {p^2}$$

...with $p$ being an odd prime number. I'm pretty much sure that the statement is correct (I have tested it by computer for many values of $p$ and did not find an exception). 
What puzzles me is the fact that the statement is trivial and obviously true for$\pmod p$. The left-hand side is congruent to $-1 \pmod p$ by Fermat's little theorem, and the right-hand side is also congruent to $-1 \pmod p$ by Wilson's theorem. 
However, I am unable to "lift the exponent" and go from$\pmod p$ to$\pmod {p^2}$. Maybe the sum on the left could somehow be transformed using the existence of a primitive root$\pmod {p^2}$.
Thanks and happy holidays!
 A: One may also use the fundamental theorem of symmetric polynomials applied to the polynomial $f(x_1,\dots,x_{p-1})=x_1^{p-1}+\dots+x_{p-1}^{p-1}+(p-1)x_1\dots x_{p-1}\in \mathbb{Z}[x_1,\dots,x_{p-1}]$. Suppose $f=g(\sigma_1,\dots,\sigma_{p-1})$, where $\sigma_i$'s are elementary symmetric polynomials, and $g$ is a polynomial with integer coefficients. Let $\zeta$ is the $p$-th root of unity. Note that since $f(\zeta,\zeta^2,\dots,\zeta^{p-1})=0$ and all $\sigma_i$'s except for $\sigma_{p-1}$ vanish at $(\zeta,\zeta^2,\dots,\zeta^{p-1})$, there is no monomial $\sigma_{p-1}$ in $g$. It remains to note that $\sigma_i(1,2,\dots,p-1)$ is divisible by $p$ for any $i<p-1$ and so $f(1,2,\dots,p-1)$ is divisible by $p^2$ which easily implies the result.   
A: The result can be easily proved without using Bernoulli numbers. If $a$ and $b$ are integers not divisible by an odd prime $p$, then
\begin{align}(ab)^{p-1}-1=&b^{p-1}(a^{p-1}-1)+(b^{p-1}-1)
\\\equiv& (a^{p-1}-1)+(b^{p-1}-1)\pmod {p^2}.\end{align} Thus
\begin{align*}\sum_{n=1}^{p-1}(n^{p-1}-1)\equiv& \prod_{n=1}^{p-1}n^{p-1}-1=((p-1)!+1-1)^{p-1}-1
\\\equiv &(p-1)((p-1)!+1)(-1)^{p-2}\equiv(p-1)!+1\pmod{p^2}\end{align*}
and hence the desired congriuence follows.
A: You may use Faulhaber's formula
$$
\sum_{k=1}^p k^{p-1}=\frac{p^p}p+\frac12 p^{p-1}+\sum_{k=2}^{p-1} \frac{B_k}{k!}\,(p-1)^{\underline{k-1}}\,p^{p-k}.
$$
All summands except this corresponding to $k=p-1$ are divisible by $p^2$ (they are not integers, but corresponding Bernoulli numbers do not have $p$ in denominators). For $k=p-1$ you get $pB_{p-1}$. For evaluating it modulo $p^2$ we may use the formula for Bernoulli numbers via Worpitzky numbers:
$$
B_{p-1}=\sum_{k=0}^{p-1} (-1)^k\frac{k!}{k+1}\left\{\matrix{p\\k+1}\right\}.
$$ 
All summands except corresponding to $k=0$, $k=p-1$ are divisible by $p$ (the corresponding Stirling numbers of the second kind are divisible by $p$ dues to the action of the cyclic shifts group on the partitions of $\{1,2,\dots,p\}$). For $k=0$ and $k=p-1$ we get $pB_{p-1}\equiv (p-1)!+p\pmod {p^2}$ as desired.
A: It is a theorem of Lerch of 1905. An elementary proof can be found in this article of Sondow : https://arxiv.org/abs/1110.3113
