Evaluating: $\int \frac {1+\sin (x)}{1+\cos (x)} dx$ 
Evaluate: $\int \dfrac {1+\sin (x)}{1+\cos (x)} dx$

My Attempt:
$$=\int \dfrac {1+\sin (x)}{1+\cos (x)} dx$$
$$=\int \dfrac {(\sin (\dfrac {x}{2}) + \cos (\dfrac {x}{2}))^2}{2\cos^2 (\dfrac {x}{2})} dx$$
$$=\dfrac {1}{2} \int (\dfrac {\sin (\dfrac {x}{2}) + \cos (\dfrac {x}{2})}{\cos (\dfrac {x}{2})})^2 dx$$
$$=\dfrac {1}{2} \int (\tan (\dfrac {x}{2}) +1)^2 dx$$
How do I continue?
 A: You were almost there, just substitute $t=\tan(\frac x2)$ now.
$\displaystyle\dfrac 12\int \left(1+\tan(\dfrac x2)\right)^2\mathop{dx}=\int \dfrac{(1+t)^2}2\times\dfrac{2\mathop{dt}}{1+t^2}=\int \left(1+\dfrac{2t}{1+t^2}\right)\mathop{dt}=t+\ln(1+t^2)+C$
Remark that you can substitute directly without intermediate trigonometric changes :
$\dfrac{1+\sin(x)}{1+\cos(x)}=\dfrac{1+\frac{2t}{1+t^2}}{1+\frac{1-t^2}{1+t^2}}=\dfrac{1+2t+t^2}{2}$
A: Second method is to split numerator
$$\int\frac{\sec^2(x/2)}{2}dx+\int\frac{\sin x}{1+\cos x}dx$$
So answer is $$\tan(x/2)-\ln|1+\cos x|+c$$
A: An alternate way is this
$$\int \dfrac {1+\sin (x)}{1+\cos (x)} dx=\int \dfrac {1+\sin (x)}{1+\cos (x)} \dfrac {1-\cos (x)}{1-\cos (x)} dx=\int \dfrac {(1+\sin (x))(1-\cos(x))}{\sin^2(x)} dx\\=\int \csc^2(x)+\csc(x)-\csc(x)\cot(x)-\cot(x) dx$$
A: *

*OP's question: how to continue?

*existing answers: start over with simpler steps


So I feel the need to respond to the original question.
\begin{align}
\int \frac {1+\sin (x)}{1+\cos (x)} dx
&=\frac {1}{2} \int (\tan (\frac {x}{2}) +1)^2 dx \\
&= \frac12 \int (\tan^2(\frac x2)+1) dx + \int \tan(\frac x2) dx \\
&= \frac12 \int \sec^2(\frac x2) dx + \int \tan(\frac x2) dx \\
&= \tan(\frac x2) + 2\ln|\sec \frac x2| + C
\end{align}
A: Here is another trick
$$
\begin{align}
I&=\int \dfrac {1+\sin (x)}{1+\cos (x)} dx\\
&=\int \dfrac {1+ \sin(0)+\sin (x)}{\cos(0)+\cos (x)} dx\\
&=\int \dfrac {1+ 2\sin(x/2)\cos (x/2)}{2\cos^2(x/2)}dx\\
&=\int \dfrac {1}{2\cos^2(x/2)}dx+\int \dfrac {\sin(x/2)}{\cos(x/2)}dx\\
&=\int \dfrac {1}{2\cos^2(x/2)}dx+\int {\tan(x/2)}dx\\
I&=\tan(x/2)-2\ln|\cos(x/2)|+K
\end{align}
$$
A: I may contribute by multiplying $(1-\cos(x))/(1-\cos(x)) $ :
$$ \int \frac{1 + \sin(x)}{1 + \cos(x)} dx= \int \frac{1 + \sin(x) - \cos(x) - \sin(x)\cos(x)}{1 - \cos^{2}(x)} dx = \int \frac{1 + \sin(x) - \cos(x) - \sin(x)\cos(x)}{\sin^{2}(x)} dx = \int \frac{\sin^{2}(x) + \cos^{2}(x) + \sin(x) - \cos(x) - \sin(x)\cos(x)}{\sin^{2}(x)} dx $$
$$ = \int \left(1 + \cot^{2}(x) + \frac{1}{\sin(x)}\right) dx - \int \frac{d(\sin(x))}{\sin^{2}(x)}  - \ln | \sin(x)|$$
$$= x + \int \cot^{2}(x)dx + \int \frac{1}{\sin(x)}dx + \frac{1}{\sin(x)}-\ln|\sin(x)| $$
Now for one integral, multiply by $(1+\cos(x))/(1+\cos(x)) $ :
$$ \int \frac{1}{sin(x)} dx = \int \frac{1+\cos(x)}{\sin(x)(1+\cos(x))} dx = \int \frac{\sin^{2}(x) + \cos^{2}(x) + \cos(x)}{\sin(x)(1+\cos(x))} dx $$
$$ \int \frac{\sin(x)}{1+\cos(x)}dx + \int \frac{\cos(x)}{\sin(x)} dx = - \ln|1+\cos(x)| + \ln|\sin(x)| $$
so ...
$$ \int \frac{1 + \sin(x)}{1 + \cos(x)} dx= x  - \ln|1+\cos(x)| + \frac{1}{\sin(x)} + \int \cot^{2}(x)dx$$
The last part may be continued..
A: From where you are you did a great job, note that


$$(\tan (\frac{x}{2}))' =\frac{1}{2}(1+\tan^2 (\frac{x}{2}))~~~and~~~ -2(\ln|\cos  (\frac{x}{2})|)' = \tan (\frac{x}{2})$$
Therefore $$\dfrac {1}{2} \int (\tan (\dfrac {x}{2}) +1)^2 dx =  \dfrac {1}{2}\int (\tan^2 (\dfrac {x}{2}) +1) dx + \int \tan (\dfrac {x}{2}) dx  \\=\tan (\frac{x}{2}) -2\ln|\cos  (\frac{x}{2})|+c$$
A: The integration of
$$\frac{\sin x}{1+\cos x}$$ which is of the form $f'(x)/f(x)$ is immediate. The rest is
$$\int\frac{dx}{1+\cos x}=\int\frac{dx}{2\cos^2\frac x2}$$ and
$$I=-\log|1+\cos x|+\tan\frac x2+C.$$
