Evaluating the integral $\int_{-\infty}^{\infty} \frac{(1-ix)^{n-s_1}}{(1+ix)^{n+s_2}} dx$. How can one show that for $s_1,s_2 \in \mathbb{C}$ $$
\begin{aligned}
\int_{-\infty}^{\infty} \frac{(1-ix)^{n-s_1}}{(1+ix)^{n+s_2}}  dx = &amp;   2\sin(\pi(n+s_2))2^{1-s_1-s_2} \Gamma(1-n-s_2)\Gamma(s_1+s_2-1)/ \Gamma(s_1-n)  &amp; \\ = &amp; 2^{2-s_1-s_2}\pi \Gamma(s_1+s_2-1)/[\Gamma(n+s_2)\Gamma(s_1-n)]. 
\end{aligned} 
$$

If I recall correctly this could be done with complex analysis noting that the integral is equal to
$$
\int_{C} \frac{(1-ix)^{n-s_1}}{(1+ix)^{n+s_2}}  dx,
$$

where $C$ starts from $+i \infty$ along the imaginary axis and goes around $i$ once in a small circle (positive direction) and then goes back to $+i\infty$.

However this doesn't help me since I don't know how we can deform the contour to $C$ and to evaluate this contour integral.
One considers the complex contour integral

$$\oint_C dz \frac{(1-i z)^{n-s_1}}{(1+i z)^{n+s_2}} $$

where $C$ is a semicircle of radius $R$ in the upper half plane, with a detour along either side of the imaginary axis and around the branch point $z=i$ with a circle of radius $\epsilon$.  We take as a branch cut the ray $\operatorname{Re}{z} =0$, $\operatorname{Im}{z} \gt 1$.  The contour integral is zero by Cauchy's theorem.  Writing the contour integral out, we get

$$\int_{-R}^R dx \frac{(1-i x)^{n-s_1}}{(1+i x)^{n+s_2}} + i R \int_0^{\pi/2} d\theta \, e^{i \theta} \frac{(1-i R e^{i \theta})^{n-s_1}}{(1+i R e^{i \theta})^{n+s_2}} \\ + i \int_R^{1+\epsilon} dy \, \frac{(1+y)^{n-s_1}}{(1-y)_+^{n+s_2}} + i \epsilon \int_{\pi/2}^{-3 \pi/2} d\phi \, e^{i \phi} \frac{(2-i \epsilon e^{i \phi})^{n-s_1}}{(i \epsilon e^{i \phi})^{n+s_2}} \\+ i \int_{1+\epsilon}^R dy \, \frac{(1+y)^{n-s_1}}{(1-y)_-^{n+s_2}} + i R \int_{\pi/2}^{\pi} d\theta \, e^{i \theta} \frac{(1-i R e^{i \theta})^{n-s_1}}{(1+i R e^{i \theta})^{n+s_2}} = 0 $$

In the third and fifth intgerals, I use the subscripts $\pm$ to denote the effect of the different sides of the branch cut on the quantity that subscript modifies.  That is, $(1-y)_+^{n+s_2} = e^{i \pi (n+s_2)} (y-1)^{n+s_2}$ and $(1-y)_-^{n+s_2} = e^{-i \pi (n+s_2)} (y-1)^{n+s_2}$.

We take the limits as $R \to \infty$ and $\epsilon \to 0$.  Thus, we assume that $s_1$ and $s_2$ are defined such that the second and sixth integrals vanish in this limit, i.e., $\operatorname{Re}{(s_1+s_2)} \gt 1$.  Also, the fourth integral vanishes when $\operatorname{Re}{(n+s_2)} \lt 1$, which we will assume to be the case.  Thus, we have,

$$\begin{align}\int_{-\infty}^{\infty} dx \frac{(1-i x)^{n-s_1}}{(1+i x)^{n+s_2}} &amp;= -i \int_{\infty}^1 dy \frac{(y+1)^{n-s_1}}{(y-1)^{n+s_2} e^{i \pi (n+s_2)}} -i \int_1^{\infty} dy \frac{(y+1)^{n-s_1}}{(y-1)^{n+s_2} e^{-i \pi (n+s_2)}}\\ &amp;= i (-2 i \sin{[\pi (n+s_2)]})  \int_1^{\infty} dy \frac{(y+1)^{n-s_1}}{(y-1)^{n+s_2}}\\ &amp;=  2 \sin{[\pi (n+s_2)]} \int_0^{\infty} dy \, y^{-(n+s_2)} (y+2)^{n-s_1}\\ &amp;= 2^{2-s_1-s_2} \sin{[\pi (n+s_2)]} \int_0^{\infty} dy \, y^{-(n+s_2)} (y+1)^{n-s_1}\\ &amp;= 2^{2-s_1-s_2} \sin{[\pi (n+s_2)]} \int_1^{\infty} dy \, (y-1)^{-(n+s_2)} y^{n-s_1}\\&amp;= 2^{2-s_1-s_2} \sin{[\pi (n+s_2)]} \int_0^1 du \, u^{s_1+s_2-2} (1-u)^{-(n+s_2)} \end{align}$$

We recognize that last integral as a beta integral.  Thus, we have

$$\int_{-\infty}^{\infty} dx \frac{(1-i x)^{n-s_1}}{(1+i x)^{n+s_2}} = 2^{2-s_1-s_2} \sin{[\pi (n+s_2)]} \frac{\Gamma(s_1+s_2-1) \Gamma(1-n-s_2)}{\Gamma(s_1-n)} $$

Finally, using the reflection formula, i.e., $\pi/\sin{(\pi z)} = \Gamma(z) \Gamma(1-z)$, we get the result we seek in final form:


  $$\int_{-\infty}^{\infty} dx \frac{(1-i x)^{n-s_1}}{(1+i x)^{n+s_2}} = \frac{4 \pi \, \Gamma(s_1+s_2-1)}{2^{s_1+s_2} \Gamma(s_1-n) \Gamma(n+s_2)} $$


This is, as mentioned above, subject to the constraints $\operatorname{Re}{(s_1+s_2)} \gt 1$ and $\operatorname{Re}{(n+s_2)} \lt 1$.

ADDENUDUM

Here is a problem that is both a special case and a little bit of a generalization at the same time.  Note that there are two branch points rather than the single one here.

ADDENUDUM II
I made an error in the integral about the small circle about the branch point; there, $z=i+\epsilon \, e^{i \phi}$.  That error has been corrected and there is now an additional constraint that must be satisfied by the parameters $n$ and $s_2$ for the posted result to remain valid.
$\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&amp;\int_{-\infty}^{\infty}
{\pars{1 - \ic x}^{n - s_{1}} \over \pars{1 + \ic x}^{n + s_{2}}}\,\dd x =
-\ic\int_{-\infty\,\ic}^{\infty\,\ic}
{\pars{1 - x}^{n - s_{1}} \over \pars{1 + x}^{n + s_{2}}}\,\dd x =
-\ic\int_{1 - \infty\,\ic}^{1 + \infty\,\ic}
{\pars{2 - x}^{n - s_{1}} \over x^{n + s_{2}}}\,\dd x
\\[5mm] = &amp;\
-2\ic\int_{1 - \infty\,\ic}^{1 + \infty\,\ic}
{2^{n - s_{1}}\pars{1 - x/2}^{n - s_{1}} \over
2^{n + s_{2}}\pars{x/2}^{n + s_{2}}}\,{\dd x \over 2}
\\[5mm] = &amp;\
-2^{-s_{1} - s_{2} + 1}\ \ic
\color{#44f}{\int_{1/2 - \infty\,\ic}^{1/2 + \infty\,\ic}
x^{-n - s_{2}}\,\pars{1 - x}^{n - s_{1}}\,\dd x}\label{1}\tag{1}
\end{align}




  I'll take the principal branch of $\ds{z^{-n - s_{2}}}$ and the branch-cut of
  $\ds{\pars{1 - z}^{n - s_{1}}}$ 'along' $\ds{\left[1,\infty\right)}$ with
  $\ds{0 &lt; \,\mrm{arg}\pars{1 - z} &lt; 2\pi}$. The integration is performed by closing the contour in a 'big semicircle' $\ds{\,\mc{C}_{R}}$ of radius $\ds{R}$ with $\ds{\Re\pars{z} &lt; {1 \over 2}}$. The integration along $\ds{\,\mc{C}_{R}}$ vanishes out, when $\ds{R \to \infty}$, whenever
  $\ds{\pars{~\Re\pars{-s_{1} - s_{2} + 1} &lt; 0 \implies
\Re\pars{s_{1} + s_{2} &gt; 1}~}}$


\begin{align}
&amp;\color{#44f}{\int_{1/2 - \infty\,\ic}^{1/2 + \infty\,\ic}
x^{-n - s_{2}}\,\pars{1 - x}^{n - s_{1}}\,\dd x}
\\[5mm] \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\sim} &amp;\
-\int_{-\infty}^{-\epsilon}\pars{-x}^{-n - s_{2}}
\exp\pars{\ic\pi\pars{-n - s_{2}}}\pars{1 - x}^{n - s_{1}}\,\dd x
\\[5mm] &amp; -
\int_{\pi}^{-\pi}\epsilon^{-n - s_{2}}\exp\pars{\ic\theta\pars{-n - s_{2}}}
\epsilon\expo{\ic\theta}\ic\,\dd\theta
\\[5mm] &amp; -
\int_{-\epsilon}^{-\infty}\pars{-x}^{-n - s_{2}}
\exp\pars{-\ic\pi\pars{-n - s_{2}}}\pars{1 - x}^{n - s_{1}}\,\dd x
\\[1cm] = &amp;\
-\pars{-1}^{n}\exp\pars{-\ic\pi s_{2}}\int_{\epsilon}^{\infty}x^{-n - s_{2}}
\pars{1 + x}^{n - s_{1}}\,\dd x
\\[5mm] &amp; -
2\ic\,\pars{-1}^{n}\,{\sin\pars{\pi s_{2}} \over n + s_{2} - 1}\,
\epsilon^{-n - s_{2} + 1}
\\[5mm] &amp; +
\pars{-1}^{n}\exp\pars{\ic\pi s_{2}}\int_{\epsilon}^{\infty}x^{-n - s_{2}}
\pars{1 + x}^{n - s_{1}}\,\dd x
\\[1cm] = &amp;\
2\ic\pars{-1}^{n}\sin\pars{\pi s_{2}}\int_{\epsilon}^{\infty}x^{-n - s_{2}}
\pars{1 + x}^{n - s_{1}}\,\dd x -
2\ic\,\pars{-1}^{n}\,{\sin\pars{\pi s_{2}} \over n + s_{2} - 1}\,
\epsilon^{-n - s_{2} + 1}
\\[1cm] = &amp;\
2\ic\pars{-1}^{n}\sin\pars{\pi s_{2}}\,\times
\\[5mm] &amp;\ \bracks{%
{\epsilon^{-n - s_{2} + 1}\pars{1 + \epsilon}^{n - s_{1}} \over n + s_{2} - 1} -
{1 \over -n - s_{2} + 1}\int_{\epsilon}^{\infty}x^{-n - s_{2} + 1}
\pars{n - s_{1}}\pars{1 + x}^{n - s_{1} - 1}\,\dd x}
\\[5mm] &amp; -
2\ic\,\pars{-1}^{n}\,{\sin\pars{\pi s_{2}} \over n + s_{2} - 1}\,
\epsilon^{-n - s_{2} + 1}
\\[1cm] \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\to} &amp;\
2\ic\pars{-1}^{n}\sin\pars{\pi s_{2}}\,
{n - s_{1} \over n + s_{2} - 1}\int_{0}^{\infty}
{x^{-n - s_{2} + 1} \over \pars{1 + x}^{s_{1} -n + 1}}\,\dd x\label{2}\tag{2}
\\[5mm] = &amp;\
-2\ic\pars{-1}^{n}\,{\sin\pars{\pi s_{2}} \over n + s_{2} - 1}\,
\Gamma\pars{2 - n - s_{2}}\,{s_{1} - n \over \Gamma\pars{s_{1} - n + 1}}
\,\Gamma\pars{s_{1} + s_{2} - 1}
\\[1cm] = &amp;\
-2\ic\pars{-1}^{n}\,{\sin\pars{\pi s_{2}} \over n + s_{2} - 1}\,
{\pi \over \Gamma\pars{-1 + n + s_{2}}\sin\pars{\pi\bracks{-1 + n + s_{2}}}}
\,{1 \over \Gamma\pars{s_{1} - n}}
\\[5mm] &amp; \Gamma\pars{s_{1} + s_{2} - 1}
\\[1cm] = &amp;\
-2\ic\pars{-1}^{n}\,\sin\pars{\pi s_{2}}\,
{\pi \over \Gamma\pars{n + s_{2}}\pars{-1}^{n - 1}\sin\pars{\pi s_{2}}}
\,{1 \over \Gamma\pars{s_{1} - n}}\,\Gamma\pars{s_{1} + s_{2} - 1}
\\[5mm] = &amp;\
2\pi\ic\,
{\Gamma\pars{s_{1} + s_{2} - 1} \over
\Gamma\pars{n + s_{2}}\Gamma\pars{s_{1} - n}}\label{3}\tag{3}
\end{align}
In the last steps, I used the $\ds{\Gamma}$-Recurrence Property and the Euler Reflection Formula. The integral in \eqref{2} is a well know
Beta function integral representation which requires
\begin{align}
&amp;\Re\pars{\bracks{-n - s_{2} + 1} + 1} &gt; 0\,,\quad
\Re\pars{s_{1} + s_{2} - 1} &gt; 0
\\[5mm] &amp;
\implies
\Re\pars{s_{2} + n} &lt; 2\ \mbox{and}\ \Re\pars{s_{1} + s_{2} &gt; 1}
\end{align}




  With \eqref{1} and \eqref{3}:


\begin{align}
&amp;\int_{-\infty}^{\infty}
{\pars{1 - \ic x}^{n - s_{1}} \over \pars{1 + \ic x}^{n + s_{2}}}\,\dd x =
\pars{-2^{-s_{1} - s_{2} + 1}\ \ic}\bracks{%
2\pi\ic\,
{\Gamma\pars{s_{1} + s_{2} - 1} \over
\Gamma\pars{n + s_{2}}\Gamma\pars{s_{1} - n}}}
\\[5mm] = &amp;\
\bbx{\ds{{4\pi \over 2^{s_{1} + s_{2}}}\,
{\Gamma\pars{s_{1} + s_{2} - 1} \over
\Gamma\pars{n + s_{2}}\Gamma\pars{s_{1} - n}}}}\,,\qquad
\Re\pars{s_{1} + s_{2}} &gt; 1\,,\quad\Re\pars{s_{2} + n &lt; 2}
\end{align}