You have
Now, by the product rule, .
times that gives
Subtracting from that gives the second line:
To see that this is the same as the third line, use the quotient rule:
and, of course, if we know that is a function of r only, we can change the partial derivatives symbols to common derivatives: to d.