Artificial intelligent assistant

Integrating Cosecant by Multiplying it by $\csc(x)+\cot(x)$ From what I’ve seen you integrate cosecant by multiplying it by $\csc(x)+\cot(x)$: How do you know to multiply it by this?

$$\int\frac{1}{\sin{x}}dx=\int\frac{\sin{x}}{\sin^2x}dx=\int\frac{\sin{x}}{1-\cos^2x}dx=$$ $$=-\frac{1}{2}\int\left(\frac{1}{1+\cos{x}}+\frac{1}{1-\cos{x}}\right)d(\cos{x})=$$ $$=-\ln\frac{1+\cos{x}}{1-\cos{x}}+C=\ln\frac{1-\cos{x}}{1+\cos{x}}+C.$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ae242a7172eb88eb458f2e4b035b6fb8