I am asked to evaluate, principal value of $$\int_{-\infty}^\infty\frac{\cos(x)}{a^2-x^2} \, dx=\pi \frac{\sin (a)}{a},a>0$$
If we start from $$\oint\limits_{C}\frac{e^{iz}}{a^2-z^2}dz,a>0$$ the line $C$ is composed of the half circle $\Gamma$, pole circles at $-a,a, \gamma_1,\gamma_2$ whose circumferences are ($r,r_1,r_2$), and a portion of the $x$-axis. If we use the Cauchy remainder theorem, we get $$ \begin{split} \int_0^\pi \frac{e^{ir\cos \theta -r\sin \theta}} {a^2-r^2e^{2-\theta}} ire^{i\theta} \, d\theta &+ \int_{-r}^{-a-r_2} f(x) \, dx + J_2 \\ &+ \int_{-a+r_2}^{a-r_1} f(x) \, dx + J_1 + \int_{a+r_1}^r f(x) \, dx = 0 \end{split} $$ Since $\left|\int_0^\pi \frac{e^{ir\cos \theta -rsin \theta}}{a^2-r^2 e^{2-\theta}}ire^{i\theta} \, d\theta\right|\leq{\frac{\pi r}{r^2-a^2},(r>a)}$ We get $$\lim_{n \to \infty}\int_0^\pi \frac{e^{ir\cos \theta -r\sin \theta}}{a^2-r^2e^{2-\theta}}ire^{i\theta} \, d\theta=0$$ Evaluating residuum at $J_{1}$ and $J_{2}$ we get $$J_1=\operatorname{Res}f(a)=\lim_{x \to a}(a-x)\frac{e^{ix}}{(a-x)(a+x)} =\frac{e^{ia}}{2a}$$ and $$J_2= \operatorname{Res}f(-a)=\lim_{x \to -a}(a+x)\frac{e^{ix}}{(a-x)(a+x)}=\frac{e^{-ia}}{2a}$$ In my book the author got $J_{1}=\frac{\pi i}{2a}e^{ia}\land J_2=-\frac{\pi i}{2a} e^{-ia}$ Where does the $\pi i$ come from ? also, why - in the second one? Is it because the residuum is at $-a$? Then, adding those two gives us the result, but still, where does $\pi$ come from?