This supposed identity is false. Let a=π/3, then cot(a/2)=cot(π/6)=tan(π/3)=√3.
tan(a)csc(a)=sin(a)csc(a)sec(a)=sec(a), so sec(a)csc(a)-tan(a)csc(a)=sec(a)(csc(a)-1).
sec(π/3)=2; csc(π/3)=2/√3=2√3/3.
sec(π/3)csc(π/3)-tan(π/3)csc(π/3)=sec(π/3)(csc(π/3)-1)=2(2√3/3-1).
tan2(π/3)=3, so sec(π/3)-tan2(π/3)+1=2-3+1=0, therefore:
(sec(π/3)csc(π/3)-tan(π/3)csc(π/3))/(sec(π/3)-tan2(π/3)+1)=2(2√3/3-1)/0 which is undefined, whereas cot(π/6)=√3.