$\int_{-\infty}^{\infty }\frac{x^{2} \, dx}{x^{4}+a^{4}}$ I'm considering the following integral:
$$\int_{-\infty}^{\infty }\frac{x^{2} \, dx}{x^{4}+a^{4}}$$
I do not know how to factor the denominator to calculate the residues.
I'm stuck here:
$$(x^{2}-|a|^{2}i)(x^{2}+|a|^{2}i)$$
Thank you so much.
 A: To tackle this problem through complex analysis is straightforward once you are confident with the right tools (localization of roots, Cauchy's integral formula, the residue theorem). My suggestion for you is to study them properly and try to get the job done by yourself. In the meanwhile, I will show you a real-analytic solution. The $a$ parameter is irrelevant: it can be removed through the substitution $x=az$, so the problem boils down to computing
$$ \int_{-\infty}^{+\infty}\frac{z^2}{1+z^4}dz = \int_{0}^{+\infty}\frac{2z^2}{1+z^4}\,dz = \int_{0}^{1}\frac{2z^2}{1+z^4}\,dz + \int_{0}^{1}\frac{2}{1+z^4}\,dz $$
that is:
$$ 2 \int_{0}^{1}\frac{1+z^2}{1+z^4}\,dz = 2 \int_{0}^{1}\frac{1+z^2-z^4-z^6}{1-z^8}\,dz \\= 2\sum_{n\geq 0}\left(\frac{1}{8n+1}+\frac{1}{8n+3}-\frac{1}{8n+5}-\frac{1}{8n+7}\right) $$
or
$$ \frac{\pi}{4}\left(\cot\frac{\pi}{8}-\cot\frac{3\pi}{8}\right)=\color{red}{\frac{\pi}{\sqrt{2}}} $$
by the reflection formula for the Digamma function.
A: Famously, even Leibniz had trouble with this one. The first factorisation is
$$ (x^2+\sqrt{2}ax+a^2)(x^2-\sqrt{2}ax+a^2), $$
and then you can use the quadratic formula.
A: You almost have it.
$$(z-|a|^2i)=(z-|a|^2e^{i\pi/2})=(z-|a|e^{i\pi/4})(z+|a|e^{i\pi/4}$$
And
$$(z+|a|^2i)=(z+i|a|e^{i\pi/4})(z-i|a|e^{i\pi/4} )$$
Putting it together we find that
$$z^4+a^4=(z-|a|e^{i\pi/4} )(z-|a|e^{-i\pi/4})(z-|a|e^{i3\pi/4})(z-|a|e^{-i3\pi/4})$$
which provides the factorization to facilitate evaluation of the residues.

Finding the Residues:
To actually find the residues, we note that since the all of the poles ($z_p$) are of first order, then we can write
$$\begin{align}
\text{Res}\left(\frac{z^2}{z^4+a^4}, z=z_p\right)&=\lim_{z\to z_p}\frac{(z-z_p)z^2}{z^4+a^4}\\\\
&=\lim_{z\to z_p}\frac{2z(z-z_p)+z^2}{4z^3}\\\\
&=\frac{1}{4z_p}
\end{align}$$
where $z_p=|a|e^{\pm i\pi/4},|a|e^{\pm i3\pi/4}$.

Evaluating the Integral:
The poles in the upper-half plane are at $z=|a|e^{i\pi/4}$ and $z=|a|e^{i3\pi/4}$.  Equipped with the residues, we can evaluate the integral as
$$\begin{align}
\int_{-\infty}^\infty \frac{x^2}{x^4+a^4}\,dx&=2\pi i \left(\frac{1}{4|a|e^{i\pi/4}}+\frac{1}{4|a|e^{i3\pi/4}}\right)\\\\
&=2\pi i \frac{-i\sqrt{2}}{4|a|}\\\\
&=\frac{\pi}{\sqrt{2}|a|}
\end{align}$$
A: Note
$$\int_{-\infty}^{\infty }\frac{x^{2} \, dx}{x^{4}+a^{4}}=2\int_{0}^{\infty }\frac{x^{2} \, dx}{x^{4}+a^{4}}=2\int_{0}^{\infty }\frac{x^{2} \, dx}{x^{4}+a^{4}}=\frac{2}{a}\int_{0}^{\infty}\frac{x^{2} \, dx}{x^{4}+1}.$$
Changing variable $x^4+1=\frac1t$, one has
\begin{eqnarray}
&&\frac{2}{a}\int_{0}^{\infty}\frac{x^{2} \, dx}{x^{4}+1}\\
&=&\frac{1}{2a}\int_{0}^{1}t^{\frac14-1}(1-t)^{\frac34-1}dt\\
&=&\frac1{2a}B(\frac14,\frac34)\\
&=&\frac1{2a}\Gamma(\frac14)\Gamma(\frac34)\\
&=&\frac{\pi}{\sqrt2a}.
\end{eqnarray}
Here
$$ \Gamma(z)\Gamma(1-z)=\frac{\pi}{\sin(\pi z)}. $$
A: $\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}$

A 'real' approach:

\begin{align}
\int_{-\infty}^{\infty }{x^{2} \over x^{4} + a^{4}}\,\dd x & =
{2 \over \verts{a}}\int_{0}^{\infty}{x^{2} \over x^{4} + 1}\,\dd x =
{2 \over \verts{a}}\int_{0}^{\infty}{\dd x \over x^{2} + 1/x^{2}}
\\[5mm] & =
{2 \over \verts{a}}\int_{0}^{\infty}{\dd x \over \pars{x - 1/x}^{2} + 2} =
{2 \over \verts{a}}\int_{\infty}^{0}{1 \over \pars{1/x - x}^{2} + 2}
\,\pars{-\,{1 \over x^{2}}}\,\dd x
\\[5mm] & =
{1 \over \verts{a}}\int_{0}^{\infty}{1 \over \pars{x - 1/x}^{2} + 2}
\pars{1 + {1 \over x^{2}}}\,\dd x =
{1 \over \verts{a}}\int_{-\infty}^{\infty}{\dd x \over x^{2} + 2} =
\\[5mm] & =\bbx{\ds{{\root{2}\pi \over 2}\,{1 \over \verts{a}}}}
\end{align}
A: $x^4+a^4 = (x^2+a^2)^2-2a^2x^2 = (x^2-\sqrt{2}ax +a^2)(x^2+\sqrt{2}ax +a^2)$
A: Find the indefinite integral.
First, determine constants $p, q, r, s$ such that
$$
\frac{px+q}{x^2+\sqrt{2}ax+a^2}+\frac{rx+s}{x^2-\sqrt{2}ax+a^2} = \frac{x^2}{x^4+a^4}
$$
By comparing the coefficients of $x^3, x^2, x, 1$, we have the following relational expression:
$$
p+r=0, \\
-\sqrt{2}a(p-r)+q+s=1, \\
a^2(p+r)-\sqrt{2}a(q-s)=0, \\
(q+s)a^2=0
$$
Thus, $p=-\frac{1}{2\sqrt{2}a}, \ q=0, \ r=\frac{1}{2\sqrt{2}a}, \ s=0$.
Based on those,
$$
\int \frac{x^2}{x^4+a^4}dx \\
= \int \left\{ -\frac{\frac{1}{2\sqrt{2}a}(x+\frac{\sqrt{2}}{2}a)}{x^2+\sqrt{2}ax+a^2} + \frac{\frac{1}{2\sqrt{2}a}(x-\frac{\sqrt{2}}{2}a)}{x^2-\sqrt{2}ax+a^2} + \frac{1}{4}\frac{1}{x^2+\sqrt{2}ax+a^2} + \frac{1}{4}\frac{1}{x^2-\sqrt{2}ax+a^2} \right\} dx \\
= -\frac{1}{4\sqrt{2}a}\log{(x^2+\sqrt{2}ax+a^2)} + \frac{1}{4\sqrt{2}a}\log{(x^2-\sqrt{2}ax+a^2)} \\
+ \frac{1}{4}\int \left\{ \frac{1}{(x+\frac{1}{\sqrt{2}}a)^2+\frac{a^2}{2}} + \frac{1}{(x-\frac{1}{\sqrt{2}}a)^2+\frac{a^2}{2}} \right\} dx
$$
The remaining integral is,
$$
\frac{1}{4} \cdot \frac{2}{a^2} \int \left\{ \frac{1}{(\frac{\sqrt{2}}{a}x+1)^2+1} + \frac{1}{(\frac{\sqrt{2}}{a}x-1)^2+1} \right\} dx \\
= \frac{1}{2\sqrt{2}a} \left\{ \tan^{-1}(\frac{\sqrt{2}}{a}x+1) + \tan^{-1}(\frac{\sqrt{2}}{a}x-1) \right\} + Const.
$$
To sum up,
$$
\int \frac{x^2}{x^4+a^4}dx \\
= \frac{1}{4\sqrt{2}a}\log {\frac{x^2-\sqrt{2}ax+a^2}{x^2+\sqrt{2}ax+a^2}} + \frac{1}{2\sqrt{2}a} \left\{ \tan^{-1}(\frac{\sqrt{2}}{a}x+1) + \tan^{-1}(\frac{\sqrt{2}}{a}x-1) \right\} + Const.
$$
After that, check each item of the result when $x \rightarrow \infty$ or $-\infty$ and calculate.
