we can prove this by using the principle of mathematical induction.
for n = 1,
LHS = 1/2 * tan (x/2)
RHS = 1/2 Cot(x/2) - Cot x
= 1/2 Cot(x/2) - (1- Tan^2 x/2)/(2 Tan x/2)
= (1 - 1 + tan^2 x/2)/(2 tan x/2) = 1/2 * tan (x/2)=LHS
Let us assume that given identity is true for n. We will use the formula for expansion of Cot (2A) = 1/tan (2A) like in the above for Cotx. For n+1,
LHS = [1/2^n * Cot (x/2^n) - Cot x ] + 1/2^(n+1) * Tan (x/2^(n+1))
= - Cot x +[1- tan^2 (x/2^(n+1)) -Tan^2 (x/2^(n+1))]
/ tan(x/2^(n+1) / 2^(n+1)
= - Cot x + 1/2^(n+1) * Cot (x/2^(n+1))
= RHS for n+1
hence proved