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?

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.
