Principal value integral by contour integration I'm preparing for an exam and am trying to evaluate the following practice integral:
$$P\int_{-\infty}^\infty \frac{e^{-ix}}{x^n} \, dx $$
where $n$ is a positive integer. $P$ here denotes that the integral is the Principal Value kind.
I can do the $n=1$ using the Indentation Lemma (or using the famous Dirichlet integral ) but for $n>1$ the Indentation Lemma (or doing it directly with the same contour) seems to fails.
The contour I am trying is contour along the real line completed by a semi-circle in the lower half plane, with an semi circle indent at $z=0$.
A solution would be very much appreciated.
 A: In the special case of $n=1$ we can assign a value to the divergent integral by means of the Cauchy principal value interpretation
$$
PV\int_{-\infty}^\infty \frac{e^{-ix}}{x} \, \mathrm dx=\lim_{\epsilon\to 0^+}\left(\int_{-\infty}^{-\epsilon}+\int_\epsilon^\infty\right)\frac{e^{-ix}}{x} \, \mathrm dx=-i\pi.
$$
However, as you rightfully pointed out, when $n>1$ the Cauchy principal value interpretation fails to converge, which is due taking the limit $\epsilon\to 0$. In such cases we may turn to other means of regularization to assign values to the integral. The paper I linked to in the comments provides a means of assigning finite values to your integral for all $n=1,2,\dots$ via the Analytic Principal Value (APV) integral. Since $e^{-iz}$ is an analytic function we may compute the APV for your problem as
$$
APV\int_{-\infty}^\infty \frac{e^{-ix}}{x^n} \, \mathrm dx=\int_{-\infty}^{-\epsilon} \frac{e^{-ix}}{x^n} \, \mathrm dx+\int_\epsilon^\infty \frac{e^{-ix}}{x^n} \, \mathrm dx+\frac{1}{2}\left(\int_{\gamma^+}+\int_{\gamma^-}\right)\frac{e^{-iz}}{z^n} \, \mathrm dz,
$$
where $\gamma^+$ and $\gamma^-$ denote semicircular paths of radius $\epsilon$ into the upper and lower halfs of the complex plane, respectively. Note that since $e^{-iz}$ is analytic the value of the APV here is independent of the choice of $\epsilon>0$. Upon inspection, the APV is regularizing your integral by integrating along two separate paths that deform above and below the singular point and then computing their average.
I will leave it to you to work through the computations but here is a Mathematica implementation of the APV for your specific problem as well as a list of values for the first several $n$.
APV[n_, \[Epsilon]_] := 
 Integrate[Exp[-I x]/x^n, {x, -Infinity, -\[Epsilon]}] + 
  Integrate[Exp[-I x]/x^n, {x, \[Epsilon], Infinity}] + 
  1/2 (Integrate[
      Exp[-I \[Epsilon] Exp[I z]]/(\[Epsilon] Exp[I z])^
        n I \[Epsilon] Exp[I z], {z, Pi, 0}] + 
     Integrate[
      Exp[-I \[Epsilon] Exp[I z]]/(\[Epsilon] Exp[I z])^
        n I \[Epsilon] Exp[I z], {z, -Pi, 0}]);
FullSimplify[Table[{n, APV[n, 1]}, {n, 1, 10, 1}]]

$$
\left(
\begin{array}{cc}
n &APV\\
 1 & -i \pi  \\
 2 & -\pi  \\
 3 & \frac{i \pi }{2} \\
 4 & \frac{\pi }{6} \\
 5 & -\frac{i \pi }{24} \\
 6 & -\frac{\pi }{120} \\
 7 & \frac{i \pi }{720} \\
 8 & \frac{\pi }{5040} \\
 9 & -\frac{i \pi }{40320} \\
 10 & -\frac{\pi }{362880} \\
\end{array}
\right)
$$
A: Continuing @AaronHendrickson's point about analytic principal value computations:
For $0<\Re(s)<1$ and $\xi\in\mathbb R$, the integral $I(s)=\int_{-\infty}^\infty \mathrm{sgn}(x){e^{-2\pi i\xi x} \over |x|^s}\;\;dx$ converges, though not absolutely. It converges conditionally at infinity for $\xi\not=0$, being a sort of alternating-decreasing thing, and converges absolutely at $0$. It is obviously a Fourier transform, when we let $\xi$ be variable.
The standard integration-by-parts stunt shows that the tempered distribution $u_s$ given by $u_s(f)=\int_{-\infty}^\infty {\mathrm{sgn}(x)\over |x|^s}f(x)\;dx$ has a meromorphic continuation in $s$. The only poles are at $s=2,4,6,\ldots$. The residues are (constant multiples of) $\delta'$, $\delta'''$, $\delta^{(5)}$, etc. Yes, this takes a bit of work to see, but it's worth going through it, since this issue is very widely relevant.
So the question can be construed as asking about the pointwise value $\widehat{u_s}(1/2\pi)$. The Fourier transform is certainly a tempered distribution, but need not have pointwise values. Nevertheless, in fact, since the "bad set" for $u_s$ and $\widehat{u_s}$ is just $\{0\}$, away from $0$ that Fourier transform does have pointwise values.
Homogeneity (and parity) considerations show that $\widehat{u_s}=c_s\cdot u_{1-s}$, for a constant $c_s$ depending holomorphically on $s$ (at least away from poles). So $\widehat{u_s}(1/2\pi)$ is $c_s$ times $(2\pi)^{s-1}$.
The constant $c_s$ can be determined by applying both $u_s$ and $u_{1-s}$ to the modified Gaussian $g(x)=xe^{-\pi x^2}$, which is $-i$ times its own Fourier transform in this normalization. This will account for the pattern of factorials that @AaronHendrickson's numerical computation shows..)
A: Here, we present another interpretation of the principal value integral as written in the posted question
$$\text{P}\int_{-\infty}^\infty\frac{e^{-ix}}{x^n}\,dx$$
for $n\in\mathbb{N}_{>0}$.

We will rely heavily on the machinery in THIS ANSWER that I posted on the Fourier Transform of $|x|^\alpha$ for $\alpha\in \mathbb{R}$.  In that answer, we defined a distribution that permits our defining the Fourier Transform of $|x|^\alpha$ for $\alpha \le -1$.  In the ensuing development, we restrict $\alpha$ to the negative integers.

Proceeding, we let $n\in \mathbb{N}_{>0}$.  We define the distribution $\lambda_1$ such that for any $\phi\in \mathbb{S}$ (i.e., $\phi$ is a Schwarz Space function)
$$\langle \lambda_1, \phi\rangle = \int_{|x|\le 1}\frac{\phi(x)-\sum_{m=0}^{n-1} \frac{\phi^{m}(0)}{m!}x^m}{x^{n}}\,dx\tag1$$
where we interpret the value of the integral as its Cauchy Principal Value.
Equipped with the distribution defined in $(1)$, we proceed to determine the Fourier Transform of $\psi(x)=x^{-n}$.

Denoting $\psi(x)=x^{-n}$ and $\phi\in \mathbb{S}$ and using the distribution defined in $(1)$, we see that
$$\begin{align}
\langle \mathscr{F}\{\psi\},\phi\rangle &=\langle \psi,\mathscr{F}\{\phi\}\rangle \\\\
&=\int_{-\infty}^\infty \frac1{x^n} \int_{-\infty}^\infty \phi(k)\left( e^{-ikx}-\sum_{m=0}^{|n|-1}\frac{(-ik)^m}{m!}x^m\right)\,dk\,dx\tag2\\\\
&=\frac1{(n-1)!} \int_{-\infty}^\infty \frac1x \int_{-\infty}^\infty \phi(k)(-ik)^{n-1}(e^{-ikx})\,dk\,dx\tag3\\\\
&=\frac{(-i)^{n-1}}{(n-1)!}\int_{-\infty}^\infty k^{n-1}\phi(k)\int_{-\infty}^\infty \frac{e^{-ikx}}{x}\,dx\,dk\tag4\\\\
&=\frac{(-i)^n \pi}{(n-1)!}\int_{-\infty}^\infty k^{n-1}\text{sgn}(k)\phi(k)\,dk\tag5
\end{align}$$


NOTES:
In going from $(2)$ to $(3)$, we integrated by parts $n-1$ times.  Justifucation of the interchange of the order of integration in going from $(3)$ to $(4)$ is left as an exercise for the reader (See THIS ANSWER for a way forward).  Finally, we note that the real part of the integrand of the inner integral in $(4)$ is odd and integrates to $0$, while the imaginary part is $-\frac{\sin(kx)}{x}$ and integrates to $-\pi \text{sgn}(k)$.


From $(5)$, we see that in distribution, the Fourier transform of $\psi(x)=x^{-n}$, $n\in \mathbb{N}_{>0}$ is
$$\mathscr{F}\{\psi\}(k)=\frac{(-i)^n \pi}{(n-1)!}k^{n-1}\text{sgn}(k)$$
Setting $k=1$, we have the result that
$$\bbox[5px,border:2px solid #C0A000]{\text{P}\int_{-\infty}^\infty \frac{e^{-ix}}{x^n}\,dx=\frac{(-i)^n\pi}{(n-1)!}}\tag6$$
where $\text{P}\int_{-\infty}^\infty \frac{e^{-ix}}{x^n}\,dx$  in $(6)$ is interpreted under the distribution defined in $(1)$.  The expression in $(6)$ generalizes the result presented in Aaron Hendrickson's post for $1\le n\le 10$.
