TITLE: Evaluating $\int_{0}^{\frac{\pi}{2}} x^n \csc(x) dx$
QUESTION [11 upvotes]: Just from messing around on WolframAlpha, I've come across an interesting integral. For the integral
$$
\operatorname{I}\left(n\right) =
\int_{0}^{\frac{\pi}{2}}x^{n}\csc\left(x\right)\,{\rm d}x\,,
$$
there are some pretty interesting answers when evaluating them at certain values. For example:
\begin{align}
\operatorname{I}\left(1\right) & = 2C
\\[2mm]
\operatorname{I}\left(2\right) & =
2\pi C - {7 \over 2}\,\zeta\left(3\right)
\\[2mm]
\operatorname{I}\left(3\right) & =
\frac{1}{128}\left[192\,\pi^{2}\,C -\psi^{\left(3\right)}
\left(\frac{1}{4}\right) +\psi^{\left(3\right)}\left(\frac{3}{4}\right)\right]
\\[2mm]
\operatorname{I}\left(4\right) & =
\pi^{3}\,C -
24\pi\,{\rm i}\operatorname{Li}_{4}\left(-{\rm i}\right) + \frac{93}{2}\,\zeta(5) - \frac{7}{480}\,{\rm i}\pi^{5}
\end{align}

With each step up, we introduce a new family of functions.
I cannot for the life of me distinguish a pattern to try to come up with what $\operatorname{I}\left(n\right)$ might be.
The only thing that I can discern, is obviously
$\operatorname{I}\left(n\right)$ includes a term including $\pi^{n-1}\, C$.

Can someone give me some kind of idea as to how I might evaluate these $?$.

REPLY [6 votes]: Reexpress the integral as
\begin{align}
I(n)=&\int_{0}^{\frac{\pi}{2}} x^n \csc x\>dx
\overset{t=e^{i x}}=-\frac2{i^n}\int_1^i \frac{\ln^n t}{1-t^2}dt\\
=&\frac2{i^n}\left( \int_0^1 \frac{\ln^n t}{1-t^2}dt -\int_0^1  \frac{i\ln^n (it)}{1+t^2}dt \right)\\
=&\frac2{i^{n}}\int_0^1 \frac{\ln^n t}{1-t^2}dt -\frac2{i^{n-1}} \sum_{k=0}^n\binom{n}{k} (\frac{i\pi}2)^{n-k}\int_0^1  \frac{\ln^k t}{1+t^2}dt \tag1
\end{align}
and note that
$$\int_0^1 \frac{\ln^n t}{1-t^2}dt=(1-2^{-n-1})n!\zeta(n+1)
,\>\>\>\>\>
\int_0^1 \frac{\ln^k t}{1+t^2}dt=(-1)^k k! \beta(k+1)
$$
Substitute above into (1) and keep only the real parts (i.e. odd $k$) to obtain
\begin{align}
 I(n) =\>(2-2^{-n})n!\zeta(n+1)\text{Re}(i^n)
- \sum_{k=1}^{[\frac{n+1}2]} (\frac{\pi}2)^{n+1-2k}\>\frac{2(-1)^k n!}{(n+1-2k)!} \>\beta(2k)
\end{align}