While solving an integral doing trigonometric substitution, I ended up at solving
I know by head that the answer is
However, I could not figure out how to do it manually. I've first tried to transform the integral to $$\int\csc\theta\cot\theta$$ and then integrate by part, but the end result was not at all correct.
Now I suppose that the path I've chosen is incorrect, so please would someone point me in the right direction ?