If $p$ is a prime number and $a, b \in \mathbb{Z}$ such that $a,b \lt p$, then how could we prove that $p$ divides
$\left(a^{p - 2} + a^{p - 3} b + a^{p - 4} b^2 + \cdots + b^{p - 2}\right)$?
If $p$ is a prime number and $a, b \in \mathbb{Z}$ such that $a,b \lt p$, then how could we prove that $p$ divides
$\left(a^{p - 2} + a^{p - 3} b + a^{p - 4} b^2 + \cdots + b^{p - 2}\right)$?
We have $(a-b)(a^{p-2} + a^{p-3}b + \ldots + ab^{p-3} + b^{p-2}) = a^{p-1} - b^{p-1}.$ If $p\nmid a$ and $p\nmid b$ then the right side is congruent to $1-1 = 0$ by Fermat's little theorem, i.e $p$ divides the product on the left. If furthermore $a \not\equiv b \pmod p$ then $p$ must already divide $a^{p-2} + a^{p-3}b + \ldots + ab^{p-3} + b^{p-2}$.
The statement becomes false if you do not assume $a \not\equiv b \pmod p$, e.g. for $a=b=1$ the sum equals $p-1$ which is not divisible by $p$. Also, if $p| a$ (w.l.o.g.) the sum is congruent to $b^{p-2}$ which is only divisible by $p$ if $p|b$.
$\sum_{r=0}^{p-2}a^rb^{p-2-r}=\frac{a^{p-1}-b^{p-1}}{a-b}.$
Now, $c^{p-1}\equiv 1\pmod p $ for $(c,p)=1$, so
$a^{p-1}-b^{p-1}≡0\pmod p \implies \frac{a^{p-1}-b^{p-1}}{a-b}≡0\pmod p $ as $(a-b,p)=1$ when $a,b < p$.
Hint $ $ Let $\rm\:f(x)\, =\, x^{p-1}\!- b^{p-1}\,$ in: $\rm\ a\ne b\:$ roots of $\rm\:f(x)\ \Rightarrow\, a\ $ is a root of $\rm\:f(x)/(x\!-\!b),\: $ for $\rm\,f\in\Bbb Z_p[x]$
Remark $\ $ This is essentially the induction step in proving that a polynomial over a domain has no more roots than its degree, via Factor Theorem. Here, by iterating this, we obtain the factorization
$\rm\ x^{p-1}\!- 1\ =\ (x-1)\,(x-2)\,(x-3)\cdots (x-(p\!-\!1))\quad in\ \ \Bbb Z_p[x]$