Concept:
To solve an indefinite integral involving trigonometric functions, we try to simplify the integrand using standard trigonometric identities. A very helpful half-angle identity for $1 + \cos x$ is:
\[
1 + \cos x = 2\cos^2\left(\frac{x}{2}\right)
\]
Using this substitution transforms the denominator into a single squared trigonometric function, which can then be written as a standard integrable function like $\sec^2\left(\frac{x}{2}\right)$.
Step 1: Apply the trigonometric identity to the denominator.
Let the given integral be denoted by $I$:
\[
I = \int \frac{1}{1 + \cos x} \, dx
\]
We substitute the identity $1 + \cos x = 2\cos^2\left(\frac{x}{2}\right)$ directly into the integral:
\[
I = \int \frac{1}{2\cos^2\left(\frac{x}{2}\right)} \, dx
\]
Step 2: Simplify using reciprocal trigonometric identities.
We can pull the constant factor $\frac{1}{2}$ out of the integration sign:
\[
I = \frac{1}{2} \int \frac{1}{\cos^2\left(\frac{x}{2}\right)} \, dx
\]
Since the reciprocal of $\cos\theta$ is $\sec\theta$, we know that $\frac{1}{\cos^2\left(\frac{x}{2}\right)} = \sec^2\left(\frac{x}{2}\right)$. Substituting this gives:
\[
I = \frac{1}{2} \int \sec^2\left(\frac{x}{2}\right) \, dx
\]
Step 3: Integrate using substitution or standard formulae.
We know from standard integration rules that the integral of $\sec^2(kx)$ is $\frac{\tan(kx)}{k}$. Here, $k = \frac{1}{1/2}$ inside the linear term argument:
Let $u = \frac{x}{2}$, then $du = \frac{1}{2} dx$, which means $2 du = dx$.
Substituting these values back into the expression:
\[
I = \frac{1}{2} \int \sec^2(u) \cdot (2 du) = \int \sec^2(u) \, du
\]
The standard derivative of $\tan(u)$ is $\sec^2(u)$, so:
\[
I = \tan(u) + C
\]
Substituting back $u = \frac{x}{2}$:
\[
I = \tan\left(\frac{x}{2}\right) + C
\]