<s>[INST] Computing the residue of a rational function The real integral I am trying to compute with residues/contour integration is
$\int_{-\infty}^{\infty}\frac{x^2}{(x^2+a^2)^3} \,dx$ For $a$ positive and by using the complex integral
$$\int_{C_R}\frac{z^2}{(z^2+a^2)^3} \,dz$$
For some arc bounding only the positive pole, $a i$. I am not sure how to evaluate this pole of order 3.
In class we have discussed how we can write a function $f(z)$ with a pole of order $n$ at $z_0$ multiplicatively as 
$$f(z)=\frac{g(z)}{(z-z_0)^n}$$ or additively as
$$f(z)=\frac{a_{-n}}{(z-z_0)^n}+\cdots+\frac{a_{-1}}{z-z_0}+h(z)$$
For holomorphic functions on a disc around the pole $h,g$, which I think is equivalent to finding a Laurent series 
This yields the formula for the residue
$$\text{Res}(f,z_0)=\lim_{z\rightarrow z_0}\frac{1}{(n-1)!}\frac{d^{n-1}}{dz^{n-1}}[
  (z-z_0)^nf(z)]$$
Which gets messy. Is there a more elegant way?
 [/INST] Computing the residue as @joriki suggested
\begin{align*}
  \text{Res}(f,z_0)&=\lim_{z\rightarrow z_0}\frac{1}{(n-1)!}\frac{d^{n-1}}{dz^{n-1}}[
  (z-z_0)^nf(z)]\\
  &\Rightarrow   \text{Res}(f,ai)=\frac{1}{2}\lim_{z\rightarrow ai}\frac{d^2}{dz^2}
  [(z-ai)^{3}\frac{z^2}{(z^2+a^2)^3}]=
  \frac{1}{2}\lim_{z\rightarrow ai}\frac{d^2}{dz^2}
  [(z-ai)^{3}\frac{z^2}{(z-ai)^3(z+ai)^3}]\\
  &=\frac{1}{2}\lim_{z\rightarrow ai}\frac{d^2}{dz^2}
  [\frac{z^2}{(z+ai)^3}]=\frac{1}{2}\lim_{z\rightarrow ai}\frac{d}{dz}
  [\frac{z(2ai-z)}{(z+ai)^4}]\\
  &=\frac{1}{2}\lim_{z\rightarrow ai}\frac{2(ai-z)}{(z+ai)^4}
  -4\frac{z(2ai-z)}{(z+ai)^5}=
  -4\frac{1}{2}\lim_{z\rightarrow ai}\frac{z(2ai-z)}{(z+ai)^5}\\
  &=-2\frac{(ai)^2}{(2ai)^5}=\frac{1}{16ia^3}
\end{align*}
yielding then for our integral:
\begin{align*}
    \int_{C_R}\frac{z^2}{(z^2+a^2)^3}dz&=2\pi i  \text{Res}(f,ai)=\frac{2\pi i}{16ia^3}
    =\frac{\pi}{8a^3}
\end{align*}
Now, to send the arc legnth to zero, we parametrize the arc as usual $\gamma_R(t)=Re^{it}$, $t\in [0,\pi]$,
and bounding our integrand using the max and path length
\begin{align*}
  |\int_{\gamma_R}\frac{z^2}{(z^2+a^2)^3}&|\leq
  \max_{|z|=R}|\frac{z^2}{(z^2+a^2)^3}|*||\gamma_R(t)||=
  \frac{R^2}{(R^2+a^2)^3}\pi R\sim cR^{-3}\rightarrow 0\;\text{as}\;
  R\rightarrow \infty
\end{align*}
Yielding our answer:
\begin{align*}
  \lim_{R\rightarrow \infty}\int_{-R}^{R}\frac{z^2}{(z^2+a^2)^3}dz=\int_{-\infty}^{\infty}\frac{z^2}{(z^2+a^2)^3}dz=\frac{\pi}{8a^3}
\end{align*}
</s>