In this paper the following beautiful integral expression for $\zeta(3)$ is derived:

$$\zeta(3)=\frac{1}{7}\,\int_0^{\pi} x\,(\pi-x)\csc(x)\, dx$$

In a comment at the end of this question, I mentioned the following tweak:

$$f(n):= \int_0^{\pi} x^n\,(\pi-x)\csc(x)\,dx$$

Maple and Mathematica both return closed forms for $f(n)$ as a finite series of $\zeta(2k+1)$, weighted by $π^m$ and a rational ($n,k,m \in \mathbb{N}$). This is what I get for $n=1..12$ :

I then tried to find a closed form for the above and got as far as:

For $n=$ odd: $$f(n)=\scriptsize \left(\Gamma(n+1)\,\sum_{k=1}^{n}(-1)^{k+1}\,\frac{(4-2^{1-2k})\,k\,\pi^{n+1-2k}}{\Gamma(2+n-2k)}\,\zeta(2k+1)\right)-\left(\frac{i}{2}\right)^{n+1}\,(2^{n+2}-1)\,\Gamma(n+2)\,\zeta(n+2)$$

For $n=$ even: $$f(n)=\scriptsize \left(\Gamma(n+1)\,\sum_{k=1}^{n}(-1)^{k+1}\,\frac{(4-2^{1-2k})\,k\,\pi^{n+1-2k}}{\Gamma(2+n-2k)}\,\zeta(2k+1)\right)+\left(\frac{i}{2}\right)^{n}\,(2^{n+1}-1)\,\pi\,\Gamma(n+1)\,\zeta(n+1)$$

Note that only the last part differs, which encourages me to believe that a simpler formula might exist. Could this be simplified? Since the CAS-tools evaluate the integral very quickly into the series, I am also keen to better understand which mathematical steps they take.

Thanks.

1more comment