Solution:
We have:
I=∫cosx/1+sin2xdx
Let sinx=tanθ. This may look like a wild substitution, but the goal is to get the denominator of the fraction to 1+tan2θ=sec2θ. Note that differentiating sinx=tanθ gives cosxdx=sec2θdθ. It's also helpful that cosxdx is already present in the integrand. Substituting these in:
I=∫sec2θ/1+tan2θdθ=∫dθ = θ+C
Since sinx=tanθ, we see that θ=arctan(sinx):
I=arctan(sinx)+C