Integral $ \int_0^{\pi}\frac{dx}{a + \cos{x}} $ 
For $ a > 1 $ show that
  \begin{equation}
J = \int\limits_0^{\pi}\frac{dx}{a + \cos{x}}=\frac{\pi}{\sqrt{a^2 -1}}
\end{equation}


Neither of trivial methods like integration by parts works. The most natural change of variable I see is 
\begin{equation}
t = \cos{x}\\
dt = d\cos{x}=-\sin x \, dx=-\sqrt{1 - t^2} \, dx \text{ for } x \in [0, \pi]   
\end{equation}
Therefore
\begin{equation}
J = \int\limits_{-1}^{1}\frac{dt}{(a + t)\sqrt{1 - t^2}}
\end{equation}
which seems relatively simple, but I didn't manage to either solve it by any common method or to find it in any list of integrals.
 A: Hint: $y = \tan\frac{x}{2}$, $\cos x = \cos^2\frac{x}{2} - \sin^2\frac{x}{2}$, then you will have a quadratic polynomial in the denominator
A: @Prism thank you. It's a great solution, let me share it.
Substitution $ z = e^{ix} $, than
\begin{equation}
\cos{x}=\frac{1}{2}(z + \frac{1}{z})\\
\sin{x}=\frac{1}{2i}(z - \frac{1}{z})\\
dx = -i\frac{dz}{z}
\end{equation}
Since $ \cos{x} $ takes the same values in the intervals $ (0, \pi) $ and $ (\pi, 2\pi) $ it is clear that the integral from $ 0 $ to $ \pi $ is one-half of the integral from $ 0 $ to $ 2\pi $. Taking this into account we find that the integral equals
\begin{equation}
-i\oint\limits_{|z|=1}\frac{dz}{z^2 + 2az + 1}
\end{equation}
The denominator can be factored into $ (z - \alpha)(z - \beta) $ with
\begin{equation}
\alpha = -a + \sqrt{a^2 - 1}, \ \beta = -a - \sqrt{a^2 - 1}
\end{equation}
Evidently $ |\alpha| < 1,\ |\beta| > 1 $, and the residue at $ \alpha $ is $ \frac{1}{(\alpha - \beta)} $. The value of the integral is found to be $\pi / \sqrt{a^2 - 1}$
A: Here is a solution based on usage of the Legendre function the first kind.
For $s\in\mathbb{C}$ and $x>1$ the Legendre function of the first kind, $P_s(x)$, admits the integral representation 
$$P_s(x) =\frac{1}{2\pi}\int_{-\pi}^{\pi}\left(x+\sqrt{x^2-1}\cos\theta\right)^s d\theta\tag{1}$$
Moreover, we have the relation $$P_{-s-1}=P_s\tag{2}$$
Using (1) and (2) one finds
\begin{eqnarray*}\int_{0}^{\pi}\left(\frac{x}{\sqrt{x^2-1}}+\cos\theta\right)^s d\theta &=&\frac12\int_{-\pi}^{\pi}\left(\frac{x}{\sqrt{x^2-1}}+\cos\theta\right)^s d\theta \\
&=&\frac{\pi P_s(x)}{(x^2-1)^{s/2}}=\frac{\pi P_{-s-1}(x)}{(x^2-1)^{s/2}}\end{eqnarray*}
Now,  $x>1$ and hence $x/\sqrt{x^2-1}>1$ too, and if we solve for $$a=\frac{x}{\sqrt{x^2-1}}$$ we get $$x=\frac{a}{\sqrt{a^2-1}}$$
and also $\sqrt{x^2-1}=1/\sqrt{a^2-1}$. 
Thus,
$$\int_0^{\pi}\left(a+\cos\theta\right)^s d\theta = \frac{\pi P_{-s-1}\left(\frac{a}{\sqrt{a^2-1}}\right)}{(a^2-1)^{-s/2}}.$$
Now we put $s=-1$, then (since $P_0(x)=1$) (2) gives us 
$$P_{-1}(x)=1 $$ 
and we get
$$\int_0^\pi\frac{d\theta}{a+\cos\theta}=\frac{\pi}{\sqrt{a^2-1}}$$

Note that the above method works well, i.e. leads to a explicit value, for all integer values $s$  - the reason is (2) together with the fact that Legendre functions with non-negative integer parameter reduces to Legendre polynomials, which are known from say Rodrigues' formula.

For completeness it should be mentioned that (2) can be proved by the change of variables $x+\sqrt{x^2-1}(2t-1)\mapsto 1/(x+\sqrt{x^2-1}(2u-1))$ in an other integral representation here. 
