The identity is false; it should read: 2cosec2x=sec^2xcotx. (Put x=30 degrees and you'll find that the original equation doesn't balance: 4=4/3*sqrt(3).)
This is the same as 2/sin2x=cosx/(cos^2xsinx)=1/(cosxsinx).
2/sin2x=2/(2sinxcosx)=1/(sinxcosx), so the two expressions are identical.