Question: Prove that $a^{p^2}\equiv a^p\pmod{p^2}$ for every $a\in\mathbb{Z}$
First note that when $p$ is prime and $1\leq r\leq p-1$ the binomial coefficient $$\binom{p}{r}=\frac{p!}{r!(p-r)!}$$ is divisible by $p$
Considering the binomial expansion $$((a^p-a)+a)^p=\sum_{r=0}^p\binom{p}{r}(a^p-a)^{p-r}a^r$$
Deduce that $a^{p^2}\equiv a^p\pmod{p^2}$ for every $a\in\mathbb{Z}$
Answer: We have $$a^{p^2}=((a^p-a)+a)^p=\sum_{r=0}^p\binom{p}{r}(a^p-a)^{p-r}a^r\equiv p(a^p-a)+a^p\equiv a^p\pmod{p^2}$$
Contention: I dont understand the step $$\sum_{r=0}^p\binom{p}{r}(a^p-a)^{p-r}a^r\equiv p(a^p-a)+a^p\pmod{p^2}$$
If this step could be broken down it would be greatly appreciated.
Let's consider the terms in the summation for $0<r<p$, which are all divisible by $$ \binom{p}{r}(a^p-a). $$ Since $\binom{p}{r}$ is divisible by $p$ and, by Fermat's little theorem, $a^p-a$ is also divisible by $p$, the term is divisible by $p^2$; therefore $$ p^2\Bigm| \binom{p}{r}(a^p-p)^{p-r}. $$ Thus $$ a^{p^2}\equiv (a^p-a)^p+a^p\pmod{p^2} $$ Since $p\mid (a^p-a)$, also $p^p\mid (a^p-a)^p$ and, since $p\ge2$, we have that $p^2\mid(a^p-p)^p$.