Here,
#I=intcotx/(1+cosx)dx#
#=intcosx/(sinx(1+cosx))dx#
#=int((1+cosx)-1)/(sinx(1+cosx))dx#
#=int1/sinxdx-int1/(sinx(1+cosx))dx#
#=intcscxdx-intsinx/(sin^2x(1+cosx))dx#
#=ln|cscx-cotx|-intsinx/((1-cos^2x)(1+cosx))dx#
#I=ln|cscx-cotx|-I_1,...to(D)#
#where,##I_1=intsinx/((1-cosx)(1+cosx)^2)dx#
Let, #cosx=u=>sinxdx=-du#
So,
#I_1=int(-1)/((1-u)(1+u)^2)du#
Now,
#(-1)/((1-u)(1+u)^2)=A/(1-u)+B/(1+u)+C/(1+u)^2#
#:. -1=A(1+u)^2+B((1-u)(1+u))+C(1-u)#
#u=1=>-1=A(1+1)^2=>color(red)(A=-1/4#
#u=-1=>-1=C(1+1)=>color(red)(C=-1/2#
#u=0=>-1=A(1)+B(1)+C(1)=>color(red)(A+B+C=-1#
#=>(-1/4)+B+(-1/2)=-1#
#=>color(red)(B=1/4+1/2-1=-1/4#
Thus,
#I_1=int(-1/4)/(1-u)du+int(-1/4)/(1+u)du+int(-1/2)/(1+u)^2du#
#I_1=1/4int1/(u-1)du-1/4int1/(1+u)du-1/2int(1+u)^(-2) du#
#=1/4ln|u-1|-1/4ln|u+1|-1/2((1+u)^-1/(-1))+c#
#=1/4ln|(u-1)/(u+1)|+1/2*1/(1+u)+c,where,u=cosx#
#:.I_1=1/4ln|(cosx-1)/(cosx+1)|+1/(2(1+cosx))+c#
Hence, from #(D)#
#I=ln|cscx-cotx|-1/4ln|(cosx-1)/(cosx+1)|+1/(2(1+cosx))+C#