Background: This is part b of problem 12.4.3 from Arfken, Weber, Harris Math Methods for Physicists to show that $\int_0^\infty \frac{\ln^2(z)}{1+z^2}$dz$=4(1-\frac{1}{3^3}+\frac{1}{5^3}-\frac{1}{7^3}+\dots)$.
Part b of the question asks to show that this series evaluates to $\frac{\pi^3}{8}$ by contour integration. Where is my mistake: $\lim_{z \to 0}zf(z)=0$ and $\lim_{z \to \infty}zf(z)=0$ so the big and little circle equal 0.$
Drawing a branch cut along the positive x axis and integrating counterclockwise along the positive x-axis around a big circle the negative x-axis from infinity and the little circle:
Assume $I=\int_0^\infty \frac{\ln^2(x)}{1+x^2}\text{dx}$
We can add the components of along the contour and set that equal to the value of $2\pi i \text{Res}[f(z),i]$ evaluated at the poles $\pm i$ $$\int_0^\infty \frac{\ln^2(z)}{1+z^2}\text{dz}+\int_{\infty}^0 \frac{\ln^2(z)}{1+z^2}\text{dz}=2\pi i \text{Res}[f(z),\pm i]\tag{1}$$
$$\int_0^\infty \frac{(\ln^2 \mid x\mid}{1+x^2}\text{dx}-\int_0^{\infty} \frac{(\ln\mid x\mid+2i\pi)^2}{1+x^2}\text{dx}=2\pi i \left (\lim_{z \to i}\frac{\ln^2(z)}{2z}+\lim_{z \to -i}\frac{\ln^2(z)}{2z}\right )\tag{2}$$
$$\int_0^\infty \frac{(\ln^2\mid x\mid}{1+x^2}\text{dx}-\int_0^{\infty} \frac{(\ln^2\mid x\mid+\color{red}{4\ln|x|i\pi}-4\pi^2)}{1+x^2}\text{dx}=2\pi i \left (\lim_{z \to i}\frac{\ln^2(z)}{2z}+\lim_{z \to -i}\frac{\ln^2(z)}{2z}\right )\tag{3}$$ $$0I+\color{red}{0}-\left[\tan^{-1}(x)\right]\mid^{\infty}_0(4\pi^2)\text{dx}=(2\pi i) \left (\frac{-\pi^2/4+9\pi^2/4}{2i}\right )\tag{4}$$ $$0I+2\pi^3=\frac{8\pi^3}{4}\tag{5}$$
For explanation of the red integral see here, here or here.
I found my error. It was a negative sign, and the two sides cancel to zero so you can't evaluate it this way, but I found an answer which evaluates it from negative to positive infinity so I'm marking the question as a duplicate. See dustin's answer at the link for the contour integration.