Evaluate $\displaystyle \int \limits_{0}^{\pi} \dfrac{x^2 \; \sin x \; dx}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)}$
$\begin{aligned}
\text{Let } I & = \int \limits_{0}^{\pi} \dfrac{x^2 \; \sin x \; dx}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)} \;\;\; \cdots \; (1) \\\\
& = \int \limits_{0}^{\pi} \dfrac{\left(\pi - x\right)^2 \; \sin \left(\pi - x\right) \; dx}{\left\{2 \left(\pi - x\right) - \pi \right\} \left\{1 + \left[\cos \left(\pi - x\right)\right]^2 \right\}} \\\\
& \hspace{2em} \left[\text{Note: } \int \limits_{0}^{a} f\left(x\right) \; dx = \int \limits_{0}^{a} f\left(a - x\right) \; dx\right] \\\\
& = \int \limits_{0}^{\pi} \dfrac{\left(\pi^2 - 2 \pi x + x^2\right) \; \sin x \; dx}{\left(\pi - 2x\right) \left(1 + \cos^2 x\right)} \;\;\; \cdots \; (2)
\end{aligned}$
$\therefore$ $\;$ Adding equations $(1)$ and $(2)$ gives
$\begin{aligned}
2 I & = \int \limits_{0}^{\pi} \left[\dfrac{x^2 \; \sin x}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)} + \dfrac{\left(\pi^2 - 2 \pi x + x^2\right) \; \sin x}{\left(\pi - 2x\right) \left(1 + \cos^2 x\right)}\right] \; dx \\\\
& = \int \limits_{0}^{\pi} \left[\dfrac{x^2 \; \sin x - \left(\pi^2 - 2 \pi x + x^2\right) \; \sin x}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)}\right] \; dx \\\\
& = \int \limits_{0}^{\pi} \dfrac{\left(2 \pi x - \pi^2\right) \sin x}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)} \; dx \\\\
& = \int \limits_{0}^{\pi} \dfrac{\pi \left(2x - \pi\right) \sin x}{\left(2x - \pi\right) \left(1 + \cos^2 x\right)} \; dx \\\\
& = \pi \int \limits_{0}^{\pi} \dfrac{\sin x \; dx}{1 + \cos^2 x} \;\;\; \cdots \; (3)
\end{aligned}$
Let $\cos x = u$ $\;\;\; \cdots \; (4)$
Differentiating equation $(4)$ gives
$- \sin x \; dx = du$ $\implies$ $\sin x \; dx = - du$ $\;\;\; \cdots \; (4a)$
$\text{When } \begin{cases}
x = 0, & u = \cos \left(0\right) = 1 \\
x = \pi, & u = \cos \left(\pi\right) = -1
\end{cases}$ $\;\;\; \cdots \; (4b)$
$\therefore$ $\;$ In view of equations $(4)$, $(4a)$ and $(4b)$, equation $(3)$ can be written as
$2 I = \pi \displaystyle \int \limits_{1}^{-1} \dfrac{-du}{1 + u^2}$
$\begin{aligned}
\text{i.e. } I & = \dfrac{\pi}{2} \int \limits_{-1}^{1} \dfrac{du}{1 + u^2} \hspace{3em} \left[\text{Note: } \int \limits_{b}^{a} -dx = \int \limits_{a}^{b} dx\right] \\\\
& = \dfrac{\pi}{2} \left[\tan^{-1} \left(u\right)\right]_{-1}^{1} \\\\
& = \dfrac{\pi}{2} \left[\tan^{-1} \left(1\right) - \tan^{-1} \left(-1\right)\right] \\\\
& = \dfrac{\pi}{2} \left[\dfrac{\pi}{4} - \left(\dfrac{- \pi}{4}\right)\right] \\\\
& = \dfrac{\pi}{2} \times \dfrac{\pi}{2} = \dfrac{\pi^2}{4}
\end{aligned}$