Trigonometric and exponential integral $\int _0^{\pi }\frac{\cos \left(a\sin x\right)}{1+a\cos x}e^{a\cos x}dx$ How can we prove this Integral relation?
$$\int _0^{\pi }\frac{\cos \left(a\sin x\right)}{1+a\cos x}e^{a\cos x}dx=\frac{\pi }{e}\cdot \frac{e^{\sqrt{1-a^2}}}{\sqrt{1-a^2}}$$
where $\text{  }a\in(-1,1)$.
 A: $$I(a)=\int _0^{\pi }\frac{\cos \left(a\sin x\right)}{1+a\cos x}e^{a\cos x}dx=\frac{1}{2}\Re\int _{-\pi}^{\pi }\frac{e^{i \left(a\sin x\right)}}{1+a\cos x}e^{a\cos x}dx=\frac{1}{2}\Re\int _{-\pi}^{\pi }\frac{e^{ ae^{ix}}}{1+a\cos x}dx$$
$$=\Re\int _{-\pi}^{\pi }\frac{e^{ ae^{ix}}e^{ix}}{ae^{2ix}+2e^{ix}+a}dx=\Re\,(-i)\oint_{|z|=1}\frac{e^{az}}{az^2+2z+a}dz$$
The zeros of the denominator are $z_{1,2}=-\frac{1}{a}\pm\sqrt{\frac{1}{a^2}-1}$; only one pole ($\,z_1=-\frac{1}{a}+\sqrt{\frac{1}{a^2}-1}\,\,$) lies inside the closed contour $|z|=1$.
Therefore,
$$I(a)=\Re \operatorname {Rez}_{z=z_1}\,2\pi i\,(-i)\frac{e^{az}}{az^2+2z+a}=\pi\frac{e^{a\big(-\frac{1}{a}+\sqrt{\frac{1}{a^2}-1}\big)}}{a\sqrt{\frac{1}{a^2}-1}}=\frac{\pi}{e}\frac{e^\sqrt{1-a^2}}{\sqrt{1-a^2}}$$
A: Per the generalized result
\begin{equation*}
\int_0^\pi\frac{f(e^{ix})+f(e^{-ix})}{1+2p\cos x+p^2}\mathrm dx=\frac{2\pi}{1-p^2}f(-p) ,
\end{equation*}
set $f(t)=\frac12e^{at}$ and $p = \frac{1-\sqrt{1-a^2}}a$ to obtain
$$\int _0^{\pi }\frac{\cos \left(a\sin x\right)}{1+a\cos x}e^{a\cos x}dx=\frac{\pi e^{\sqrt{1-a^2}-1}}{\sqrt{1-a^2}}$$
