Why is this proof of a congruence relation valid?

$c_k := \large -\frac{2}p\binom{p}{2k}\in\Bbb Z\,$ by $\,\large p\mid\binom{p}{2k}.\,$ $\,\color{#c00}{kc_k\equiv 1}\pmod {\!p}\,$ as they sketch. So with $\large \,\sum = \sum _{k\,=\,1}^{(p-1)/2}$

$$\bmod p\!:\,\ \sum k^{\large p-2}\equiv\sum k^{\large p-2} \color{#c00}{k\, c_k} \equiv \sum c_k =\, -\frac{2}p\sum\binom{p}{2k} =\, \frac{-2(2^{\large p-1}-1)}p\qquad\qquad$$

Note that the final $2$ equations are not congruences - they are integer equalities (the fraction $\in\Bbb Z),\,$ and the first $2$ congruences relate integers. So the proof is correct (though notation obscures that).


The ideas behind the proof are fine, but it has been written (IMHO) somewhat carelessly. You can repair it by replacing every congruence $a\equiv b\pmod p$ by an equation $a=b+mp$ and following essentially the same argument. They also have failed to mention the important fact that $\binom{p}{2k}$ is a multiple of $p$ provided $p\not\mid k$.

In the following, to save writing, $m$ represents an integer which need not be the same every time (so for example I can write $2(m+5)=m$). We have $$\frac{2k}{p}\binom{p}{2k}=-1+mp$$ and so $$\def\sk{\sum_{k=1}^{(p-1)/2}} \eqalign{ \sk k^{p-2}&=\sk k^{p-2}\Bigl(mp-\frac{2k}{p}\binom{p}{2k}\Bigr)\cr &=mp-\frac2p\sk k^{p-1}\binom{p}{2k}\cr &=mp-\frac2p\sk (1+mp)\binom{p}{2k}\cr &=mp-\frac2p\sk \binom{p}{2k}-2m\sk\binom{p}{2k}\cr &=mp-\frac2p(2^{p-1}-1)-2m\sk mp\cr &=\frac{2-2^p}{p}+mp\ .\cr}$$ Hence, $$\sk k^{p-2}\equiv \frac{2-2^p}{p}\pmod p\ .$$

Comment. The convention "$m$ represents an integer which need not be the same every time" is exactly the reason why congruence notation is very useful. On the other hand, as your question shows, sometimes congruence notation has drawbacks too.