The last step follows from repeated application of this general fact about congruences:
If $a \equiv a' \bmod m$ and $b \equiv b' \bmod m$, then $ab \equiv a'b' \bmod m$.
Indeed, $r^{p-1} \equiv 1\pmod p$ is the same as $[r^{p-1}] = [r]^{p-1} = [1]$ in $U(p)$.
(Here, $[r]$ means the class of $r \bmod p$.)
As you've noted, $[r]^{p-1} = [1]$ is a consequence of Lagrange's theorem for $U(p)$. (But it can be proved without using Lagrange's theorem since $U(p)$ is abelian.)