How to show $x^{p-2}+\cdots+x^2+x+1\equiv0\pmod{p}$ has $p-2$ incongruent solutions: $2, 3,..., p-1.$ when $p$ is an odd prime? Let $p$ be an odd prime. How would I prove that the congruence $x^{p-2}+\cdots+x^2+x+1\equiv0\pmod{p}$ has exactly $p-2$ incongruent solutions, and they are the integers $2, 3,..., p-1?$
I found this question posted, but the answer doesn't quite make sense to me.
Here is my attempt:
Proof
As $p$ is an odd prime, by Fermat's Theorem,
                \begin{align*}
            x^{p-1}&\equiv1\pmod{p}\\
            &\implies x^{p-1}-1\equiv0\pmod{p}
        \end{align*}
                and by Lagrange's Corollary, with $d=p-1, p-1\mid p-1$, this congruence has exactly $p-1$ solutions.
                \begin{align*}
            x^{p-1}-1 \pmod{p}&\equiv0\pmod{p}\\
            &\equiv  (x-1)(x^{p-2}+\cdots+x^2+x+1) \pmod{p}\\
        \end{align*}
                Assume $x^{p-2}+\cdots+x^2+x+1\equiv0\pmod{p}$...
And then I get stuck.
The proof I linked above used:

Now, $x^{p-1}-1\equiv 0\pmod{p}$ has exactly $p-1$ incongruent solutions modulo $p$ by Lagrange's Theorem.
Note that $g(1)=(1-1)f(1)=0\equiv 0\pmod{p}$, so $1$ is a root of $g(x)$ modulo $p$. Hence, the incongruent roots of $g(x)$ modulo $p$ are $1,2,3,\dots,p-1$.
But every root of $g(x)$ other than $1$ is also a root of $f(x)$ (This is the part I'm concerned about. Is it clear that this is the case?), hence $f(x)$ has exactly $p-2$ incongruent roots modulo $p$, which are $2,3,\dots,p-1$. $\blacksquare$

But I don't understand the part about roots. Nor do I quite get the use of creating $g(x)$ and $f(x)$. Could someone explain the proof using a different method?
 A: You can avoid congruences by working in the $p$-element field $\mathbb{F}_p$. The polynomial $f(x)=x^{p-1}-1$ has distinct roots (in the algebraic closure), because its derivative is $f'(x)=(p-1)x^{p-2}$, which has no common root with $f(x)$ (in any extension).
On the other hand, the group of nonzero elements in the field has order $p-1$, so for every $a\in\mathbb{F}_p$, $a\ne0$, $a^{p-1}=1$. Therefore every element in $\mathbb{F}_p\setminus\{0\}$ is a root of $f(x)$.
Since $f(x)=(x-1)(x^{p-2}+\dots+x+1)$, we see that $2,3,\dots,p-1$ (as elements of $\mathbb{F}_p$) are roots of $x^{p-2}+\dots+x+1$.
This precisely amounts to the statement you have to prove, when we go back to the integers, taking into account that $\mathbb{F}_p=\mathbb{Z}/p\mathbb{Z}$.
A: To phrase the yellow block differently; the equation $x^{p-1}-1\equiv0\pmod{p}$ has precisely $p-1$ incongruent solutions by Lagrange's theorem. These are precisely the nonzero residues modulo $p$, i.e. the congruence classes $1$, $2$,..., $p-1$. We can factor the left hand side of this equation as follows:
$$x^{p-1}-1=(x-1)(x^{p-2}+x^{p-1}+\cdots+x^2+x+1).$$
In particular this shows that if $x$ is a solution and $x-1\not\equiv0\pmod{p}$ then we must have
$$x^{p-2}+x^{p-1}+\cdots+x^2+x+1\equiv0\pmod{p}.$$
This tells us that $2$, $3$, ..., $p-1$ are solutions to the congruence.
To see that there are no other (incongruent) solutions, note that the only remaining congruence classes are $0$ and $1$. And plugging them in yields
$$0^{p-2}+0^{p-1}+\cdots+0^2+0+1\equiv1\pmod{p},$$
$$1^{p-2}+1^{p-1}+\cdots+1^2+1+1\equiv p-1\pmod{p},$$
so these are not solutions.
A: Multiply by $x-1$:
$$x^{p-2}+\cdots+x^2+x+1\equiv 0\implies (x-1)(x^{p-2}+\cdots+x^2+x+1)=x^{p-1}-1\equiv 0\mod p. $$
Lil' Fermat says the latter congruence is satisfied by every $x\not\equiv 0\mod p$. this maked $p-1$ congriuence classes. However, we must remove $1$, which does not satisfy  the given congruence equatio, since it would imply $(p-1)\cdot 1\equiv 0\mod p$.
