Tips for integrating $\int \frac{dx}{1+\cos(x)}$ I tried the following
$$ 
\int \frac{dx}{1+\cos(x)}=\int \frac{1-\cos(x)}{1-\cos^2(x)}\,dx=
\int \frac{1-\cos(x)}{\sin^2(x)}\,dx\\
=\int \frac{1}{\sin^2(x)}\,dx-\int \frac{\cos(x)}{\sin^2(x)}\,dx=\int \csc^2x\,dx-\int \cot(x)\csc(x)\,dx
$$
Which I looked up and found to be equal to 
$$
\csc(x)-\cot(x)+c
$$
Do I need to memorize the final identity, or is there a more elegant way to evaluate this integral?
 A: Here are two methodologies that provide a way forward.

METHODOLOGY $1$ Classical Weierstrass Substitution

In this classical and systematic approach, we enforce the substitution $u=\tan(x/2)$.  
Then, using $\cos(x)=\frac{1-u^2}{1+u^2}$ and $dx=\frac{2}{1+u^2}\,du$ we find
$$\begin{align}
\int \frac{1}{1+\cos(x)}\,dx&=\int \frac{2}{(1+u^2)+(1-u^2)}\,du\\\\
&=u+C\\\\
&=\tan(x/2)+C
\end{align}$$
as expected!


METHODOLOGY $2$ Use of Complex Analysis

Note that we can express the cosine function as $\cos(x)=\frac12(e^{ix}+e^{-ix})$.  Then, we can write
$$\begin{align}
\int \frac{1}{1+\cos(x)}\,dx&=\int \frac{2}{(e^{ix/2}+e^{-ix/2})^2}\,du\\\\
&=\int \frac{2e^{ix}}{(e^{ix}+1)^2}\\\\
&=\frac{2i}{(e^{ix}+1)}+C\\\\
&=\frac{2ie^{-ix/2}}{e^{ix/2}+e^{-ix/2}}+C\\\\
&=\tan(x/2)+i+C\\\\
&=\tan(x/2)+C'
\end{align}$$
As was to be shown!


EXTRA

Here we show that $\csc(x)-\cot(x)=\tan(x/2)$.  We proceed by writing
$$\csc(x)-\cot(x)=\frac{1-\cos(x)}{\sin(x)}$$
Next, we invoke the identities $1-\cos(x)=2\sin^2(x/2)$ and $\sin(x)=2\sin(x/2)\cos(x/2)$.  Therefore, we have
$$\frac{1-\cos(x)}{\sin(x)}=\frac{2\sin^2(x/2)}{2\sin(x/2)\cos(x/2)}=\tan(x/2)$$
as was to be shown!
A: The usual tables of derivatives tell you that
$$
\frac d {dx} \csc x = -\csc x \cot x
$$
and
$$
\frac d {dx} \cot x = -\csc^2 x
$$
so if you've got those, then you're almost done.
A: Here is a method similar to C. Dubussy's solution except no substitution needs to be made.
Recalling $1 = \cos^2 \frac{x}{2} + \sin^2 \frac{x}{2}$ and $\cos x = \cos^2 \frac{x}{2} - \sin^2 \frac{x}{2}$, the integral may be written as
\begin{align*}
\int \frac{dx}{1 + \cos x} &= \int \frac{dx}{\left (\cos^2 \frac{x}{2} + \sin^2 \frac{x}{2}\right ) + \left (\cos^2 \frac{x}{2} - \sin^2 \frac{x}{2} \right )}\\
&= \int \frac{dx}{2 \cos^2 \frac{x}{2}}\\
&= \frac{1}{2} \int \sec^2 \frac{x}{2} \, dx\\
&= \tan \frac{x}{2} + \cal{C}
\end{align*}
A: Do the substitution $x=2u$. $$\int \frac{dx}{1+\cos(x)} = 2\int \frac{du}{1+\cos(2u)} = \int \frac{du}{\cos^2(u)} = \tan(u)+C = \tan(x/2)+C.$$
