Consider the function $\displaystyle f(z) = \frac{z^2+2}{z^6+1}$; $f$ has simple poles at $z = \pm i, \pm i^{\frac{1}{3}}, \pm i^{\frac{5}{3}}$, three of which lie in the upper half plane;
those are $z_1 = i, ~ z_2 = i^{\frac{1}{3}}, ~ z_3 = i^{\frac{5}{3}}$. The sum of the residues at these poles is given by
$\displaystyle \begin{aligned} \sum_{1 \le i \le 3} \text{res} f(z_i) & = \frac{1}{6} (-2 i - \sqrt{3})+\frac{1}{6}(-2 i +\sqrt{3})-\frac{i}{6} \\& = -\frac{5i}{6}\end{aligned} $
Now, let $\Gamma$ be the upper half-plane semi-circle $|z| = a$ with radius $a$ in counterclockwise direction.
Since $z_1, z_2, z_3$ all lie in the upper half plane, by the residue theorem we have
$\displaystyle \begin{aligned} \oint_\Gamma f(z)\,dz & =2i \pi \sum_{1 \le i \le 3} \text{res} f(z_i) \\& = 2i \pi \cdot \frac{-5i}{6} \\& = \frac{5\pi}{3} \end{aligned}$
But also
$\displaystyle \oint_\Gamma f(z)\,dz=\int_{-a}^{a} f(z) \,\mathrm{dz} +\int_{\text{Arc}} f(z)\,\mathrm{dz}$
Therefore
$\displaystyle \int_{-a}^{a} f(z) \,\mathrm{dz} +\int_{\text{Arc}} f(z)\,\mathrm{dz} = \frac{5\pi}{3}$
By taking $a \to \infty$, since
$ \displaystyle \bigg| \int_{\text{Arc}} f(z) \,\mathrm{dz} \bigg| \le \frac{a^2+2}{a^6-1}~ a \pi \longrightarrow 0$
we have $\displaystyle \int_{\text{Arc}} f(z)\,\mathrm{dz} \to 0$ as $a \to \infty$, therefore
$\displaystyle \int_{-\infty}^{\infty}\frac{z^2+2}{z^6+1}\,\mathrm{dz} = \frac{5\pi}{3} $
Therefore (since $f$ is an even function),
$\displaystyle \int_{0}^{\infty}\frac{z^2+2}{z^6+1}\,\mathrm{dz} = \frac{5\pi}{6}. $