On the second step, I multiplied every term by tan(alpha) to get rid of the cot(alpha) in the denominator
tan(x)*cot(x) = 1
cot(x) = 1/( tan(x) )
Pay careful attention to the fact that the left hand side (LHS) stays the same the entire time. I only altered the right hand side (RHS) to transform it into the LHS.
There isn't a hard fast rule, but usually the idea is to start with the more complicated side and try to simplify it to match the other unaltered side.