Alternative (contour preferred) method to evaluate $\int_{0}^{\infty}\frac{dz}{\cosh z + \cos \theta}$ We know the indefinite integral with $d$ being the differential operator (e.g., by substitution $t=e^z$ and partial fraction)
$$\frac{dz}{\cosh z+\cos\theta}=-\frac i{\sin\theta}d\ln\frac{e^z+e^{i\theta}}{e^z+e^{-i\theta}}.$$
Can we find a nice contour in the complex plane and using the Cauchy residue theorem to directly show its definite form? 
$$\int_0^\infty\frac{dz}{\cosh z+\cos\theta}=\frac{\theta}{\sin\theta}$$
Other methods are welcome too.
The upper (neither the lower) hemispherical contour does not work because the segment integral close to the imaginary axis at infinity does not vanish.
 A: A more direct approach than the one I mentioned in the comments is to integrate $$f(z) = \frac{z}{\cosh z + \cos \theta} \, ,  \quad 0 < \theta < \pi, $$ around a rectangle in the upper half-plane of height $ 2 \pi i$. 
Doing so, we get $$ \begin{align} \int_{-\infty}^{\infty} \frac{x}{\cosh x + \cos \theta} \, dx - \int_{-\infty}^{\infty} \frac{x+ 2 \pi i }{\cosh x + \cos \theta} \, dx &= 2 \pi i \Big( \text{Res}\left[f(z), i(\pi - \theta)\right] +  \text{Res}\left[f(z), i(\pi + \theta \right)]\Big) \\ &= 2 \pi i \left(\frac{i(\pi - \theta)}{\sinh(i(\pi -\theta)) }+ \frac{i(\pi + \theta)}{\sinh(i(\pi + \theta))}\right) \\ &=2 \pi i \left(\frac{\pi - \theta}{ \sin \theta }- \frac{\pi + \theta}{ \sin \theta}\right)\\ &= - 4 \pi i \, \frac{\theta}{\sin \theta}. \end{align}$$
(The integrals along the sides of the rectangle vanish in the limit since  $|\cosh z|$ grows exponentially as $\text{Re}(z) \to \pm \infty$.)
Therefore, $$ 2 \pi i \int_{-\infty}^{\infty} \frac{1}{\cosh x + \cos \theta} \, dx =  4 \pi i \, \frac{\theta}{\sin \theta} \, ,   $$ and the result follows since the integrand is even.
