Have a look at this.
Or use the Weierstrass sub. (Also see the cosec example above it, for step-by-step.)
_________________________________________
Don't integrate - balloontegrate!
Balloon Calculus; standard integrals, derivatives and methods
Balloon Calculus Drawing with LaTeX and Asymptote!
In terms of sines and cosines:
.
Now make the substitution so that and the integral becomes
Now if you make the substitution so that then the integral becomes
.
Now applying partial fractions:
and
.
So and