Solution (source code)

= Solution

The <tangent half-angle substitution> $u=\tan(t/2)$ maps $0\leq t<\pi$ to $0\leq u<\infty$, with
$$
\cos t=\frac{1-u^2}{1+u^2},\qquad dt=\frac{2\,du}{1+u^2}.
$$
Because $a>1$, both $a+1$ and $a-1$ are positive. Thus
$$
\int_0^\pi\frac{dt}{a+\cos t}=2\int_0^\infty\frac{du}{(a+1)+(a-1)u^2}=\frac2{\sqrt{a^2-1}}\left[\arctan\left(u\sqrt{\frac{a-1}{a+1}}\right)\right]_0^\infty.
$$
Evaluating the <improper integral> gives
$$
\boxed{\frac{\pi}{\sqrt{a^2-1}}.}
$$
Although the change of variable has an infinite endpoint, the original integrand is continuous on the closed interval, and the transformed integrand decays as $u^{-2}$, so the limiting substitution is justified.