Inside the book I'm following there's a theorem, used to prove the factoring algorithm, which states:
Suppose $N = p_{1}^{\alpha_1}p_{2}^{\alpha_2}\dots p_{m}^{\alpha_m}$ is the prime factorization of an odd composite positive integer. Let $x$ be chosen uniformly at random from $Z_N^*$, and let $r$ be the order of $x$, modulo $N$. Then $p\left(r \text{ is even and } x^{\frac{r}{2}}\neq -1 (\mod N) \geq 1-\frac{1}{2^m}\right)$
The proof of this theorem is presented in the book as follows:
We show that $p\left( r \text{ is odd or } x^\frac{r}{2} = -1 (\mod N)\right) \leq \frac{1}{2^m}$. By the Chinese remainder theorem, choosing $x$ uniformly at random from $Z_N^*$ is equivalent to choosing $x_j$ independently and uniformly at random from $Z_{p_{j}^{\alpha_j}}^*$ and requiring that $x=x_j(\mod p_j^{\alpha_j})$ for each $j$. Let $r_j$ be the order of $x_j$ modulo $p_j^{\alpha_j}$. Let $2^{d_j}$ be the largest power of $2$ that divides $r_j$ and $2^d$ be the largest power of $2$ that divides $r$. We will show that to have $r$ odd or $x^{r/2}=-1(\mod N)$ it is necessary that $d_j$ takes the same value for all values of $j$. The result the follows, as from Lemma A4.12 the probability of this occurring is at most $\frac{1}{2^m}$.
The mentioned Lemma A4.12 states: Let $p$ be and odd prime. Let $2^d$ be the largest power of $2$ dividing $\varphi(p^{\alpha})$. Then with probability exactly one-half $2^d$ divides the order modulo $p^\alpha$ of a randomly chosen elemenent of $Z_{p^{\alpha}}^*$.
What I don't understand is: why the probability that $d_j = d$ for each $j$ is at most $\frac{1}{2^m}$? How is this probability linked with the one in the Lemma if the latter talks about the largest power of $2$ dividing $\varphi (p^{\alpha})$ while the theorem talks about the largest power of $2$ dividing the order $r$ (or $r_j$)?