<s>[INST] Antiderivative of $\frac{1}{1+\sin {x} +\cos {x}}$ How do we arrive at the following integral
$$\displaystyle\int\dfrac{dx}{1+\sin {x}+\cos {x}}=\log {\left(\sin {\frac{x}{2}}+\cos {\frac{x}{2}}\right)}-\log {\left(\cos {\frac{x}{2}}\right)}+C\ ?$$
 [/INST] Hint :
Rewrite the integrand as
\begin{align}
\frac{1}{1+\color{blue}{\sin x}+\color{red}{\cos x}}&=\frac{1}{\sin^2\frac x2+\cos^2\frac x2+\color{blue}{2\sin\frac x2\cos\frac x2}+\color{red}{\cos^2\frac x2-\sin^2\frac x2}}\\
&=\frac{1}{2\cos\frac x2\left(\sin\frac x2+\cos\frac x2\right)}\\
&=\frac{\sin\frac x2}{2\cos\frac x2}+\frac{\cos\frac x2-\sin\frac x2}{2\left(\sin\frac x2+\cos\frac x2\right)}.
\end{align}
Then use
$$
\int\frac{f'(x)}{f(x)}\ dx=\ln\left|f(x)\right|+C.
$$
I think this way will obtain a shorter way than a standard Weierstrass substitution.
</s>