How to Find the Recurrence Formula for $\int \frac{dx} {(1+\sin x)^n}$? 
$$\int \frac{dx} {(1+\sin x)^n}$$

I know that I should use the following step:

$$\int\frac{\sin^2(x)\, dx}{(1+\sin x)^n} +\int\frac{\cos^2(x)\, dx} {(1+\sin x)^n} $$

but here I get stuck. I do not know how shall I proceed.
 A: A more direct method exists without substitution, which I will discuss here.
Observe that:
$\displaystyle \large 2I_n - I_{n-1} = \int \frac{\cos^2{x}}{(1+\sin{x})^{n+1}} \text{d}x = \int \frac{\text{d}(1+\sin{x})}{(1+\sin{x})^{n+1}} \cos{x}$
Integrate by parts directly to obtain:
$\displaystyle \large 2I_n - I_{n-1} = -\frac{\cos{x}}{n(1+\sin{x})^n} - \frac{1}{n} \int \frac{\sin{x}}{(1+\sin{x})^n} \text{d}x$
$\displaystyle \large 2I_n - I_{n-1} = -\frac{\cos{x}}{n(1+\sin{x})^n} - \frac{I_{n-1}-I_n}{n}$
Rearrange to obtain:
$\displaystyle \large (2n-1)I_n = -\frac{\cos{x}}{(1+\sin{x})^n} + (n-1)I_{n-1}$
And the rest is trivial.
A: Let $I_n$ be the sequence given by the integral 
$$I_n=\int \frac{1}{(1+\sin(x))^n}\,dx \tag 1$$
First, we enforce the substitution $x=2y+\pi/2$ into $(1)$ to obtain
$$I_n=\int \frac{2}{(1+\cos(2y))^n}\,dy \tag 2$$
Noting that $1+\cos(2y)=2\cos^2(y)$, we write $(2)$ as
$$I_n=\frac{1}{2^{n-1}}\int \sec^{2n}(y)\,dy$$
Next, we integrate by parts with $u=\sec^{2n-2}(y)$ and $v=\tan(y)$ to obtain
$$\begin{align}
I_n&=\frac{1}{2^{n-1}}\left(\sec^{2n-2}(y)\tan(y)-(2n-2)\int \sec^{2n-2}(y)\tan^2(y)\,dy \right)\\\\
&=\frac{1}{2^{n-1}}\left(\sec^{2n-2}(y)\tan(y)-(2n-2)2^{n-1}I_n+(2n-2)2^{n-2}I_{n-1} \right)\\\\
&=\frac{n-1}{2n-1}I_{n-1}+\left(\frac{1}{2^{n-1}(2n-1)}\right)\,\sec^{2n-2}(x/2-\pi/4)\tan(x/2-\pi/4)
\end{align}$$
