How to evaluate the following integral ? What substitution will be helpful? $$\int\frac{cotx }{(1-sinx)(secx+1)}dx $$
we can write this as
$$\int \frac {cosecx.cotx}{(cosecx-1)(secx+1)}dx $$
Now $cosecx=t$ gives $cosecx.cotx=-dt $ which appears in the numerator, what to do about  $secx+1$ ?

$$\frac{\cot x}{(1-\sin x)(1+\sec x)}=\frac{1+\sin x}{\sin x(1+\cos x)}=\frac{1}{\sin x(1+\cos x)}+\frac{1}{1+\cos x}$$
Enforcing the Wiereatrass Substitution $\tan(x/2)=u$ and $dx=\frac{2}{u^2+1}\,du$ reveals
$$\begin{align}
\int \frac{\cot x}{(1-\sin x)(1+\sec x)}\,dx&=\int \left(\frac{(u^2+1)^2}{4u}+\frac{u^2+1}{2}\right)\,\frac{2}{u^2+1}du\\\\
&=\int \left(\frac12 u +\frac12 u^{-1}+1\right)\,du\\\\
&=\frac14 \tan^2\left(\frac{x}{2}\right)+\frac12 \log\left(\tan \left(\frac{x}{2}\right)\right)+\tan\left(\frac{x}{2}\right)+C
\end{align}$$
