Problem with the integral $\int_0^{+\infty} \frac{t^{m-1}}{1+t^{2n}}{\rm d}t$ I'd like to prove, using a partial fraction decomposition (I don't want to use residue calculus), that
$$\int_0^{+\infty} \frac{t^{m-1}}{1+t^{2n}}{\rm d}t=\frac{\pi}{2n\sin\frac{m\pi}{2n}}$$
where $1\le m<2n$.

*

*I find that
$$\frac{X^{m-1}}{1+X^{2n}} = \sum_{k=-n}^{n-1} \frac{\alpha_k}{X-\omega_k}$$
where $\omega_k={\rm e}^{i\theta_k}$, $\theta_k=\frac{(2k+1)\pi}{2n}$ and $\alpha_k=-\frac{\omega_k^m}{2n}$.

*Next, with $A>0$,
$$\int_0^A \frac{{\rm d}t}{t-\omega_k} = \ln A+\frac12\ln(1-2/A\cos\theta_k+1/A^2) + {\rm i}\left(\arctan\frac{A-\cos\theta_k}{\sin\theta_k} + \arctan\frac{\cos\theta_k}{\sin\theta_k}\right)$$

*When $A\to+\infty$, the sum of all the logarithms tends to $0$, because the sum of the $\alpha_k$ is zero.

*To find the limit of the sum of the $\arctan$, I group the term in $k$ and the term in $-k-1$, with $0\le k\le n-1$, because $\theta_{-k-1}=-\theta_k$, and $\sin\theta_k>0$ for $0\le k\le n-1$ and $\sin\theta_k<0$ for $-n\le k\le -1$. I find
$${\rm i}(\alpha_k-\overline{\alpha_k})\left(\frac\pi2+\arctan\frac{\cos\theta_k}{\sin\theta_k}\right)$$

*Now I find that whether $\cos\theta_k$ is positive or negative, this limit can be written $\frac{1}{n}\sin(m\theta_k)(\pi-\theta_k)$.

*So all that is left is to find a closed form of the sum
$$\frac1n\sum_{k=0}^{n-1} \sin(m\theta_k)(\pi-\theta_k)$$
If you had the patience to follow me until now, can you see where I made a mistake ? I have done this computations four or five times now, discovered a few mistakes, and I'm not closer to the result than at the beginning :-(
If you could help, it would be greatly appreciated :-)
\bye
 A: A first manipulation to reduce the integration range to $(0,1)$:
$$ I(m,n)=\int_{0}^{+\infty}\frac{t^{m-1}}{1+t^{2n}}\,dt=\int_{0}^{1}\frac{t^{m-1}}{1+t^{2n}}\,dt+\int_{1}^{+\infty}\frac{t^{m-1}}{1+t^{2n}}\,dt= \int_{0}^{1}\frac{t^{m-1}+t^{2n-m-1}}{1+t^{2n}}\,dt.$$
It leads to
$$ I(m,n)=\int_{0}^{1}\frac{t^{m-1}+t^{2n-m-1}-t^{2n+m-1}-t^{4n-m-1}}{1-t^{4n}}\,dt $$
$$ I(m,n)=\sum_{k\geq 0}\left(\frac{1}{4kn+m}+\frac{1}{4kn+2n-m}-\frac{1}{4kn+2n+m}-\frac{1}{4kn+4n-m}\right) $$
so $I(m,n)$ can be computed by applying a discrete Fourier transform (based on the $4n$-th roots of unity) to $\sum_{s\geq 1}\frac{x^s}{s}=-\log(1-x)$. We have (also due to the reflection formula for the $\psi=\Gamma'/\Gamma$ function)
$$\sum_{k\geq 0}\left(\frac{1}{4kn+m}-\frac{1}{4kn+4n-m}\right) = \frac{\pi}{4n}\cot\left(\frac{\pi m}{4n}\right) $$
and
$$ \sum_{k\geq 0}\left(\frac{1}{4kn+2n-m}-\frac{1}{4kn+2n+m}\right) = \frac{\pi}{4n}\tan\left(\frac{\pi m}{4n}\right) $$
immediately leading to the claim.
A: 

*… …


*So all that is left is to find a closed form of the sum
$$S=\frac1n\sum_{k=0}^{n-1} \sin(m\theta_k)(\pi-\theta_k)$$


*With $\theta_k=\frac{(2k+1)\pi}{2n}$, proceed as follows
\begin{align}
S=&\ \frac1{2n}\sum_{k=0}^{2n-1} \sin(m\theta_k)(\pi-\theta_k)
= -\frac1{2n}\sum_{k=0}^{2n-1} \sin(m\theta_k)\theta_k\\
=& -\frac {\pi}{2n^2}\sum_{k=0}^{2n-1} k\sin\frac{\pi(2k+1)m}{2n}
= \frac 1{2n}\frac{d}{dx}\bigg(\sum_{k=0}^{2n-1} \cos\frac{\pi(2k+1)x}{2n}\bigg)_{x=m}\\
=& \ \frac1{2n}\frac d{dx}\bigg(\frac{\sin 2\pi x}{2\sin\frac{\pi x}n} \bigg)_{x=m}
=\frac{\pi}{2n} \csc \frac{m\pi}{2n}
\end{align}
