How is the Fourier transform of $g(x)=\frac{1}{x^2-a^2}, a\in \mathbb{R}$ calculated?
I know that the Fourier transfom of $f(x)=\frac{1}{x^2+a^2}, a\in \mathbb{R}$ can be calculated by just closing the counter up and down depending on the sign of the transformed variable $p$ and we get something like $\tilde f(p)=\frac{\pi e^{a p} \theta (-p)}{a}+\frac{\pi e^{-a p} \theta (p)}{a}$
But I do not know to compute an integral fo the form \begin{equation} \int e^{-ipx}\frac{1}{x^2-a^2} \end{equation} calculated.
A direct calculation on Mathematica gave answer to be undefined but using Mathematica command to compute this Fourier translation gave \begin{equation} \tilde g(p)=-\frac{\pi \text{sgn}(p) \sin (a p)}{a} \end{equation}
I wonder how is this expression obtained.
Moreover:
Mathematica integration of $\tilde g(p)$ to find $g(x)$ gives back the correct result.
As @Calvin Khor and @herb steinberg mentioned, the integral should be considered in the principal value sense.
$$I(p)=P.V.\int_{-\infty}^{\infty}e^{-ipx}\frac{1}{x^2-a^2}dx$$
Let's take $p>0$ and consider the following contour
The big half-circle of radius $R$ in the lower half-plane (will go clockwise) and two small half circles of radius $r$ (will go counter-clockwise) are added - to make a closed contour.
$$\oint e^{-ipx}\frac{1}{x^2-a^2}dx=2\pi i \sum Res=0\, \,\text{ - there are no poles inside the contour}$$
On the other hand $$\oint=I(p)+\int_{C_1}+\int_{C_2}+\int_R=0$$ Integral along big half-circle $\int _R\to0$ as $R\to\infty$
$$\int_{C_2}=\lim_{r\to0}\int_\pi^{2\pi}\frac{e^{-ip(a+re^{i\phi})}}{2are^{i\phi}}ire^{i\phi}d\phi=\lim_{r\to0}\int_\pi^{2\pi}\frac{e^{-ipa}(1-ipre^{i\phi}+...)}{2are^{i\phi}}ire^{i\phi}d\phi=\frac{\pi i}{2a}e^{-ipa}$$ $$\int_{C_1}=-\frac{\pi i}{2a}e^{ipa}$$ $$I(p>0)=-\frac{\pi}{a}\sin(ap)$$
For $p<0$ we close the contour in the upper half-plane and go around $x=a$ and $x=-a$ along small half-circles clockwise in the upper half-plane. Negative direction gives additional minus. $$I(p)=-\frac{\pi \text{ sgn}(p) \sin (a p)}{a}$$