<s>[INST] find the complex integral: $\int_0^\infty \frac{z^6}{(z^4+1)^2}dz$. Problem with integral formula.... Question I am trying to find the complex integral: $\displaystyle\int_0^\infty \frac{z^6}{(z^4+1)^2}dz$.
My Attempt (and eventual question): $\int_0^\infty \frac{z^6}{(z^4+1)^2}dz=\frac{1}{2}\int_\infty^\infty\frac{z^6}{(z^4+1)^2}dz$.  Now, the singularities of $z^4+1$ are of the form $z_k=e^{\frac{i(\pi+2\pi k)}{4}}$, where $k=0,1,2,3$.  Drawing the contour in the upper half plane, we see tht the only two singularities in our contour are $z_0=e^{\frac{i\pi}{4}}$ and $z_1=e^{\frac{i3\pi}{4}}$.
Let $f(z)=\frac{g(z)}{h(z)}$ where $g(z)=z^6$ and $h(z)=(z^4+1)^2$.  Then, $h'(z)=8z^3(z^4+1)$.    So, the value of the integral is $2\pi i\frac{1}{2}\sum_{k=0}^1\frac{z_k^6}{8z_k^3(z_k^4+1)}=\frac{\pi i}{8}\Big(\frac{e^{i\frac{3\pi}{2}}}{e^{i\frac{3\pi}{4}}(e^{i\pi}+1)}+\frac{e^{i\frac{\pi}{2}}}{e^{i\frac{\pi}{4}}(e^{i\pi}+1)}\Big)$.  But, $e^{i\pi}+1=0$, so I must have done something wrong....?  Any insight would be great!  Thank you.
 [/INST] Note
\begin{align}
\int_0^\infty \frac{z^6}{(z^4+1)^2}dz
&\overset{z\to\frac1z}
= \int_0^\infty \frac{dz }{(z^4+1)^2}
= \frac14\int_0^\infty \frac1{z^3}d \left(\frac{z^4}{z^4+1}\right)\\
&=\frac34 \int_0^\infty \frac{dz }{z^4+1}
\overset{z\to\frac1z} = \frac38\int_0^\infty \frac{1+z^2 }{z^4+1}dz\\
& = \frac38\int_0^\infty \frac{d(z-\frac1z)}{(z-\frac1z)^2+2}
= \frac{3\pi}{8\sqrt2}
\end{align}
</s>