We first need to know these three facts,

tan x = sin x / cos x

cotan x = cos x / sin x

(sin x)^2 + (cos x)^2 = 1

Then,

tan x + cotan x = (sin x / cos x) + (cos x / sin x)

= ((sin x)^2 + (cos x)^2)/(sin x * cos x)

= 1 / (sin x * cos x)

= (1/sin x)*(1/cos x)

= csc x sec x = sec x csc x

Get the idea now? When dealing with sec x and csc x it is usually easier to put them in terms of sine and cosine and just grind through the algebra.