Evaluate $\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx$

We can adapt the formula derived in $(2)$ of this answer: $$ \log(2\cos(x/2))=\sum_{k=1}^\infty\frac{(-1)^{k-1}}k\cos(kx)\tag{1a} $$ Substituting $x\mapsto\pi-x$ in $\text{(1a)}$, we get $$ \log(2\sin(x/2))=\sum_{k=1}^\infty\frac{-1}k\cos(kx)\tag{1b} $$ Subtracting $\text{(1a)}$ from $\text{(1b)}$, the even terms cancel and we get $$ \bbox[5px,border:2px solid #C0A000]{\log(\tan(x/2))=\sum_{k=0}^\infty\frac{-2}{2k+1}\cos((2k+1)x)}\tag2 $$


Therefore, $$ \begin{align} \int_0^{\pi/2}\frac{x^2}{\sin(x)}\,\mathrm{d}x &=\int_0^{\pi/2}x^2\,\mathrm{d}\log(\tan(x/2))\tag3\\ &=-2\int_0^{\pi/2}x\log(\tan(x/2))\,\mathrm{d}x\tag4\\ &=\sum_{k=0}^\infty\frac4{2k+1}\int_0^{\pi/2}x\cos((2k+1)x)\,\mathrm{d}x\tag5\\ &=\sum_{k=0}^\infty\frac4{(2k+1)^2}\int_0^{\pi/2}x\,\mathrm{d}\sin((2k+1)x)\tag6\\ &=\sum_{k=0}^\infty\frac4{(2k+1)^2}\left[x\sin((2k+1)x)+\frac{\cos((2k+1)x)}{2k+1}\right]_0^{\pi/2}\tag7\\ &=\sum_{k=0}^\infty\frac4{(2k+1)^2}\left[\frac\pi2(-1)^k-\frac1{2k+1}\right]\tag8\\ &=\bbox[5px,border:2px solid #C0A000]{2\pi\mathrm{G}-\frac72\zeta(3)}\tag9 \end{align} $$ Explanation:
$(3)$: prepare to integrate by parts
$(4)$: integrate by parts
$(5)$: apply $(2)$
$(6)$: prepare to integrate by parts
$(7)$: integrate by parts
$(8)$: apply the limits of integration
$(9)$: evaluate, where $\mathrm{G}$ is Catalan's Constant


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ enter image description here \begin{align} \int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x & = \left.\Re\int_{x\ =\ 0}^{x\ =\ \pi/2}{\bracks{-\ic\ln\pars{z}}^{2} \over \pars{z - 1/z}/\pars{2\ic}}\,{\dd z \over \ic z} \,\right\vert_{\ z\ =\ \exp\pars{\ic x}} \\[5mm] & = \left.2\,\Re\int_{x\ =\ 0}^{x\ =\ \pi/2}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z \,\right\vert_{\ z\ =\ \exp\pars{\ic x}} \end{align}

$\ds{\ln}$ is the $\ds{\log}$-principal branch. Integration of $\ds{{\ln^{2}\pars{z} \over 1 - z^{2}}}$ along the path $\ds{C_{x}\cup C_{R}\cup C_{y}}$ vanishes out such that

$\ds{\int_{\large C_{R}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z = -\int_{\large C_{y}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z - \int_{\large C_{x}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z}$

Then, \begin{align} \int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x &\ =\ \overbrace{-2\,\Re\int_{1}^{0}{\bracks{\ln\pars{y} + \pi\ic/2}^{\, 2} \over 1 + y^{2}}\,\ic\,\dd y}^{\ds{\mbox{along}\ C_{y}}}\ -\ \overbrace{2\,\Re\int_{0}^{1}{\ln^{2}\pars{x} \over 1 - x^{2}}\,\dd x} ^{\ds{\mbox{along}\ C_{x}}} \\[5mm] & = -2\pi\,\int_{0}^{1}{\ln\pars{y} \over 1 + y^{2}}\,\dd y - 2\int_{0}^{1}{\ln^{2}\pars{x} \over 1 - x^{2}}\,\dd x \end{align}

However, $\ds{\int_{0}^{1}{\ln\pars{y} \over 1 + y^{2}}\,\dd y = -G}$ where $\ds{G}$ is the Catalan Constant such that

\begin{align} \int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x & = 2\pi G - 2\sum_{n = 0}^{\infty}\ \overbrace{\int_{0}^{1}\ln^{2}\pars{x}x^{2n}\,\dd x} ^{\ds{2 \over \pars{2n + 1}^{3}}} \\[5mm] & = 2\pi G - 4\bracks{\sum_{n = 1}^{\infty}{1 \over n^{3}} - \sum_{n = 1}^{\infty}{1 \over \pars{2n}^{3}}} = 2\pi G - {7 \over 2}\sum_{n = 1}^{\infty}{1 \over n^{3}} \\[5mm] & = \bbx{2\pi G - {7 \over 2}\,\zeta\pars{3}} \approx 1.5480 \\ & \end{align}