I decided to tackle this integral by integrating over a semicircular contour in the upper-half plane and the real line, where the path is denoted as $\Gamma$. $$\int_{\Gamma} \frac{e^{iaz}}{z^{2n}+1}dz=(\int_{C_R}+\int_{-R}^R) \frac{e^{iaz}}{z^{2n}+1}dz$$
The integral over $C_R$ should go to $0$ as $R\to\infty$ by Jordan's Lemma. Thus $$\int_{\Gamma} \frac{e^{iaz}}{z^{2n}+1}dz=\int_{-\infty}^\infty \frac{e^{iaz}}{z^{2n}+1}dz=2\pi i\sum Res$$ by Residue Theorem. The function has a pole at $z_0=e^{\frac{\pi i}{2n}}$ and calculating the Residue at $z_0$ I get
$$\lim_{z\to z_0} e^{iaz} \frac{z-z_0}{z^{2n}+1}=-e^{iaz_0}\frac{z_0}{2n}$$
So $$\int_{-\infty}^\infty \frac{e^{iaz}}{z^{2n}+1}dz=-\frac{\pi i}{n}z_0e^{iaz_0}$$
After equating the real and imaginary terms on both sides I get that $$\int_{-\infty}^\infty \frac{\cos(az)}{z^{2n}+1}dz=\frac{\pi}{n}e^{-a\sin(\frac{\pi}{2n})}(\cos(\frac{\pi}{2n})\sin(a\cos(\frac{\pi}{2n}))+\sin(\frac{\pi}{2n})\cos(a\cos(\frac{\pi}{2n})))$$ I found that this answer agrees with the Wolfram for $n=1$ but appears to be off by a factor of $2$ for $n=2$. Could anyone explain if/where I made a mistake and what the final answer should be?