Tough integral $\int_0^{ \pi }\frac{x^2(\pi-x)^2}{\sin^2 x} dx =6\pi\zeta(3) $ How to prove
$$\int_0^{ \pi }\frac{x^2(\pi-x)^2}{\sin^2 x} dx =6\pi\zeta(3),  $$
and does there even exist a closed form of $$\int_0^{ \pi }\frac{x^3(\pi-x)^3}{\sin^3 x} dx \ ?  $$
(Note that the easier one $$\int_0^{ \pi }\frac{x (\pi-x) }{\sin x} dx = 7~\zeta(3) ,\text { equivalently }\  \int_{0}^{1}\frac{x - x^{2} }{ \sin(\pi x)}dx = 7\frac{\zeta (3)}{\pi^{3}},$$ has been solved here.)
 A: Let's integrate the function $$\frac{z^{2}(\pi-z)^{2}}{\sin^{2}(z)}$$ around a tall rectangular contour with vertices at $z=0$, $z= \pi$, $z= \pi + iR$, and $z=iR$.
If we let $R \to \infty$, the integral vanishes along the top of the contour.
Since there are no singularities inside the contour, we have $$\int_{0}^{\pi} \frac{x^{2}(\pi-x)^{2}}{\sin^{2}(x)} \, \mathrm dx + \int_{0}^{\infty} \frac{(\pi + i t)^{2}(-it)^{2}}{\sinh^{2}(t)} \, i \, \mathrm dt - \int_{0}^{\infty}\frac{(it)^{2}(\pi-it)^{2}}{\sinh^{2}(t)} \, i \, \mathrm dt =0.$$
Equating the real parts on both sides of the equation, we get $$ \begin{align} \int_{0}^{\pi} \frac{x^{2}(\pi-x)^{2}}{\sin^{2}(x)} \, \mathrm dx &=4 \pi \int_{0}^{\infty} \frac{t^{3}}{\sinh^{2}(t)} \, \mathrm dt \\ &= 16 \pi \int_{0}^{\infty}\frac{ t^{3}e^{-2t}}{(1-e^{-2t})^{2}} \, \mathrm dt \\ &= 16 \pi \int_{0}^{\infty} t^{3} \sum_{n=1}^{\infty} n e^{-2tn} \, \mathrm dt \\ &= 16 \pi \sum_{n=1}^{\infty} n \int_{0}^{\infty} t^{3} e^{-2tn} \, \mathrm dt \\ &= 16 \pi \sum_{n=1}^{\infty} n \, \frac{\Gamma(4)}{(2n)^{4}} \\ &= 6 \pi \sum_{n=1}^{\infty} \frac{1}{n^{3}} \\ &=  6 \pi \zeta(3). \end{align}$$
A: A more general solution:
I’ll state the following propositions that can be trivially proven using induction, sums of geometric series, second derivatives and the use of $\tan^2 x=\sec^2 x-1$.

For $n\in\mathbb{N}$
$$\sec^{2n}(x)=\frac{(-1)^n \, 2^{2n}}{(2n-1)!} \sum_{k=1}^{\infty} (-1)^k e^{2ixk} \prod_{r=0}^{2n-2} (k-n+r+1)$$
$$\sec^{2n+1}(x)=\frac{(-1)^{n-1} \, 2^{2n+1}}{(2n)!} \sum_{k=1}^{\infty} (-1)^k e^{ix(2k-1)} \prod_{r=0}^{2n-1} (k-n+r)$$
Letting $x\mapsto \frac{\pi}{2}-x$, we recover representations of powers of $\csc x$.

To illustrate an example:
$$\csc^2 (x)= -4\sum_{k=1}^{\infty} (-1)^k k e^{2i\left(\frac{\pi}{2}-x\right)k}$$
Let’s use this to integrate
$$\begin{align} \int_{0}^{\pi} x^2 (\pi-x)^2 \csc^2 (x)\,dx &= -4\sum_{k=1}^{\infty} (-1)^k k \int_{0}^{\pi} x^2(\pi^2-x)^2 e^{2i\left(\frac{\pi}{2}-x\right)k}\,dx\\&=-4\sum_{k=1}^{\infty} (-1)^k k \cdot \left(-\frac{3\pi \, (-1)^k}{2k^4}\right)\\&=6\pi \sum_{k=1}^{\infty}\frac{1}{k^3}\\&=6\pi \zeta(3)\end{align}$$
A: Integrate by parts twice
\begin{align}
\int_0^{ \pi }\frac{x^2(\pi-x)^2}{\sin^2 x} dx 
=& \>2 \int_0^{ \frac\pi2}\frac{x^2(\pi-x)^2}{\sin^2 x} dx \\
=&\>4 \int_0^{\frac\pi2}(\pi^2x-3\pi x^2+2x^3)\cot x\> dx\\ =&\> 4\int_0^{\frac\pi2} (6\pi x-6x^2 -\pi^2)\ln(2\sin x)dx
\end{align}
Then, utilize the known results $\int_0^{\frac\pi2} \ln(2\sin x)dx=0$, $\int_0^\frac{\pi}{2}x\ln(2\sin x)dx= \frac7{16}\zeta(3)$ and $\int_0^{\frac\pi2} x^2\ln(2\sin x)\,dx=  \frac{3\pi}{16}\zeta(3)$ to arrive at
\begin{align}
\int_0^{ \pi }\frac{x^2(\pi-x)^2}{\sin^2 x} dx 
=6\pi\zeta(3),  
\end{align}
A: Letting $x\mapsto \frac{\pi}{2}-x$ changes
$$
\begin{aligned}
I=& \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\left(\frac{\pi}{2}-x\right)^{2}\left(\frac{\pi}{2}+x\right)^{2}}{\cos ^{2} x} d x = \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\left(\frac{\pi^{2}}{4}-x^{2}\right)^{2} d(\tan x)
\end{aligned}
$$
Integration by parts gives
$$
\begin{aligned}
I &=4 \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} x\left(\frac{\pi^{2}}{4}-x^{2}\right) \tan x d x=-8 \int_{0}^{\frac{\pi}{2}} x\left(\frac{\pi^{2}}{4}-x^{2}\right) d(\ln (\cos x))
\end{aligned}
$$
Integration by parts again yields
$$
I=2 \pi^{2} \int_{0}^{\frac{\pi}{2}} \ln (\cos x) d x-24 \int_{0}^{\frac{\pi}{2}} x^{2} \ln (\cos x) d x
$$
Using my post 1 and post 2, we can conclude that
$$
I=-\pi^{3} \ln 2-24\left(-\frac{\pi^{3} \ln 2}{24}-\frac{\pi}{4} \zeta (3)\right)=\frac{\pi}{6} \zeta(3)
$$
