Fourier transform of $\frac{1}{x^2-a^2} \quad a\in \mathbb{R}$ 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.
 A: 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}$$
A: I will consider a simpler version of this example, but the same technique can be used. Try splitting your integral up into multiple regions, that is to say:
$$\int_{-\infty}^\infty=\int_{-\infty}^{-a-\epsilon}+\int_{-a+\epsilon}^{a-\epsilon}+\int_{a+\epsilon}^\infty$$
now let $\epsilon\to0$.

$$\frac{1}{x^2-a^2}=\frac1{2a}\frac{1}{x-a}-\frac1{2a}\frac{1}{x+a}$$
so for ease I will just look at:
$$\int_{-\infty}^\infty\frac{1}{x-a}-\frac{1}{x+a}\,dx$$

$$\int_{-\infty}^{-a-\epsilon}\frac{1}{x-a}-\frac{1}{x+a}\,dx=\left[\ln\left(\frac{x-a}{x+a}\right)\right]_{-\infty}^{-a-\epsilon}$$
$$\int_{-a+\epsilon}^{a-\epsilon}\frac{1}{x-a}-\frac{1}{x+a}\,dx=\left[\ln\left(\frac{x-a}{x+a}\right)\right]_{-a+\epsilon}^{a-\epsilon}$$
$$\int_{a+\epsilon}^{\infty}\frac{1}{x-a}-\frac{1}{x+a}\,dx=\left[\ln\left(\frac{x-a}{x+a}\right)\right]_{a+\epsilon}^{\infty}$$
combining it all together gives (I have now included absolutes):
$$\left(\ln|-2a-\epsilon|-\ln|-\epsilon|-0\right)+\left(\ln|-\epsilon|-\ln|2a-\epsilon|-\ln|-2a+\epsilon|+\ln|\epsilon|\right)+\left(0-\ln|\epsilon|+\ln|2a+\epsilon|\right)$$
Now you can see that a lot of stuff cancels and it won't be too hard to take the limit wrt. $\epsilon$
