$d\mid p\!-\!1\Rightarrow x^d-1\pmod{\!p^2}$ has exactly $d$ roots for odd prime $p$ I'm trying to figure out the number of solutions to the congruence equation $x^d \equiv1 \pmod{p^2}$ where $p$ is prime and $d\mid p-1$.
For the congruence equation ${x^d}\equiv1 \pmod p$ where $p$ is prime and $d\mid p-1$ I've shown that there are exactly $d$ solutions modulo $p$.
I'm trying to use the above result to extend it to the higher power. I'm aware of something called Hensel's Lemma which says if a polynomial has a simple root modulo a prime  $p$, then this root corresponds to a unique root of the same equation modulo any higher power of $p$. We can 'lift' the root iteratively up to higher powers.
I'm unsure exactly how this process works. All I have to start with is that I assume a solution of the form $m+np$ solves the 'base' congruence and I'm trying to somehow extend it to $p^2$.
Any help would be appreciated.
Thanks.
 A: Set $f(x)=x^d-1$.  Each solution $m$ mod $p^k$ lifts to a unique solution mod $p^{k+1}$ exactly when $f'(m)\neq 0\pmod{p}$.  Fortunately, $f'(m)=dm^{d-1}$.  Since $d\mid p-1$, $p\nmid d$.  Since $m^d\equiv 1\pmod{p}$, $p\nmid m$.  Hence each solution mod $p$ lifts to a unique solution mod $p^2, p^3, \ldots$.  There are plenty of resources to read more about Hensel's lemma, such as Wikipedia, or here on mse.
A: Let $p$ be an odd prime, and work modulo $p^k$ (so $k$ does not have to be $2$). Then if $d$ divides $p-1$, the congruence $x^d\equiv 1\pmod{p^k}$ has exactly $d$ solutions. 
To prove this, we use the fact that there is a primitive root $g$ of $p^k$, that is, a generator of the group of invertibles modulo $p^k$. Then for $1\le n\le (p-1)p^{k-1}$, we have $(g^n)^d\equiv 1\pmod{p^k}$ if and only if $nd$ is a multiple of $(p-1)p^{k-1}$. There are $d$ different such $n$, namely $i\frac{p-1}{d}p^{k-1}$ for $i=1,2,\dots, d$. 
A: Taking Discrete Logarithm with respect to a primitive root $a\pmod {p^n}$ for integer $n\ge1,$
$$d\cdot ind_ax\equiv0\pmod {\phi(p^n)}\implies d\cdot ind_ax\equiv0\pmod {p^{n-1}(p-1)}$$
As $d|(p-1),(d,p-1)=d$ and $(p,p-1)=1\implies (d,p)=1\implies (d,p^{n-1})=d$
$\implies (d,p^{n-1}(p-1))=d$
Using Linear congruence theorem, 
as $d|0,$  there will be  has exactly $d$ solutions.
