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}$$