Integrate $\int \frac {dx}{1+\sin x}$ Integrate $\int \dfrac {dx}{1+\sin x}$
My attempt:
$$\begin{align}&=\int \dfrac {dx}{1+\sin x}\\
&=\int{\dfrac{dx}{1+\dfrac{2\tan \left( \dfrac{x}{2} \right)}{1+\tan ^2\left( \dfrac{x}{2} \right)}}}\\
&=\int{\dfrac{1+\tan ^2\left( \dfrac{x}{2} \right)}{\left( 1+\tan \left( \dfrac{x}{2} \right) \right) ^2}}\,dx\end{align}$$

See Tangent_half-angle_substitution
If $z = \tan \big(\frac x2 \big)$, then $dx = \dfrac{2 dz}{1+z^2}$
and $\sin(x) = \dfrac{2z}{1+z^2}$
\begin{align}
   \int\frac{dx}{1+\sin x} 
   &= \int\frac{1}{1+\sin x} \cdot dx \\
   &= \int \dfrac{1}{\left(1+\dfrac{2z}{(1+z^2)}\right)} 
      \cdot \dfrac{2 dz}{1+z^2} \\
   &= \int \dfrac{2 \, dz}{(1+z)^2} \\
   &= -\dfrac{2}{1+z} + C \\
   &= -\dfrac{2}{1 + \tan(\frac x2)} \\
   &= \dfrac{-2}{1 + \dfrac{\sin x}{1+\cos x}} \\
   &= -2\dfrac{1+\cos x}{1 + \cos x + \sin x}
\end{align}
