Prove $\int_0^\infty \frac{x^{k-1} + x^{-k-1}}{x^a + x^{-a}}dx = \frac{\pi}{a \cos(\frac{\pi k}{2a})}$. I need help in proving this identity
$$\int_0^\infty \frac{x^{k-1} + x^{-k-1}}{x^a + x^{-a}}dx = \frac{\pi}{a \cos(\frac{\pi k}{2a})}$$
for $0<k<a.$ It might be done using residues, but I don't know which contour to choose. 

From this post, we know that
$$ \int_0^\infty\frac{u^{\alpha-1}}{1+u^\beta}dx=\frac{\pi}{\beta\sin(\frac{\pi\alpha}{\beta})}.$$
So
\begin{eqnarray}
\int_0^\infty \frac{x^{k-1} + x^{-k-1}}{x^a + x^{-a}}dx &=&
\int_0^\infty \frac{x^{a+k-1}}{1 + x^{2a}}dx+\int_0^\infty \frac{x^{a-k-1}}{1 + x^{2a}}dx\\
&=&\frac{\pi}{2a\sin(\frac{(a+k-1)\pi}{2a})}+\frac{\pi}{2a\sin(\frac{(a-k-1)\pi}{2a})}\\
&=& \frac{\pi}{a \cos(\frac{\pi k}{2a})}
\end{eqnarray}
