Integrating $\int_0^{\pi/2}\log^2(\sin^2x)\sin^2x{\rm d}x$ after lots of discussion and help from @Chris'sis I have tried integrating it in varied ways but it involves something that is new to me:
$$ I=\int_0^{\pi/2}\log^2(\sin^2x)\sin^2x{\rm d}x$$ It could be written as:
$$I=\int_0^{\pi/2}4\log^2(\sin x)\sin^2x{\rm d}x$$
I know:
$$\int_0^{\pi/2}\log(\sin x){\rm d}x=-\frac{\pi}2\ln 2$$
And couldn't possibly work out this:
$$\int_0^{\pi/2}\log^2(\sin x){\rm d}x$$
I know there' a question on last one on MSE, but the evaluation techniques I'm unfamiliar to. 
For more info see here.
 A: Using
$$
\log(\sin(x))=-\log(2)-\sum_{k=1}^\infty\frac{\cos(2kx)}{k}
$$
and
$$
\sin^2(x)=\frac{1-\cos(2x)}2
$$
and
$$
\cos(2kx)\cos(2x)=\frac{\cos((2k+2)x)+\cos((2k-2)x)}2
$$
we get, remembering the orthogonality of $\cos(2jx)$ and $\cos(2kx)$,
$$
\begin{align}
&\int_0^{\pi/2}\log^2(\sin^2(x))\sin^2(x)\,\mathrm{d}x\\
&=4\int_0^{\pi/2}\log^2(\sin(x))\sin^2(x)\,\mathrm{d}x\\
&=4\log(2)^2\int_0^{\pi/2}\sin^2(x)\,\mathrm{d}x\\
&+4\log(2)\sum_{k=1}^\infty\int_0^{\pi/2}\frac{2\cos(2kx)-\cos((2k+2)x)-\cos((2k-2)x)}{2k}\mathrm{d}x\\
&+\sum_{k=1}^\infty\sum_{j=1}^\infty\int_0^{\pi/2}\frac{\cos(2jx)}j\frac{2\cos(2kx)-\cos((2k+2)x)-\cos((2k-2)x)}{k}\,\mathrm{d}x\\
&=\pi\log^2(2)-\pi\log(2)+\frac{\pi^3}{12}-\frac\pi2
\end{align}
$$
A: HINT: As I mentioned in chat, one of the natural ways is to use beta function in trigonometric form that immediately leads to the desired solution
$$\int_0^{\pi/2} \sin^a(x)\cos^b(x) \ dx=\frac{1}{2}B \left(\frac{1}{2}(a+1),\frac{1}{2}(b+1)\right)$$
Thus, 
$$I=4\lim_{b\to 0} \lim_{a\to2}\frac{\partial^2}{\partial a^2}\left(\frac{1}{2}B \left(\frac{1}{2}(a+1),\frac{1}{2}(b+1)\right)\right)$$
$$=\pi\log^2(2)-\pi\log(2)+\frac{\pi^3}{12}-\frac\pi2.$$
A: For historical context, here is Ramanujan's solution.
\begin{align}
\int_0^{\pi/2}\log^m(\sin(x))dx & = \int_0^1\frac{\log^m(x)}{\sqrt{1-x^2}}dx\tag{1}\\
&= (-1)^m\int_0^{\infty}t^m\sum_{n=0}^{\infty}\frac{(1/2)_ne^{-(2n+1)t}}{n!}dt\tag{2}\\
&= (-1)^mm!\sum_{n=0}^{\infty}\frac{(1/2)_n}{n!(2n+1)^{m+1}}\tag{3}
\end{align}
In $(1)$, let $x=e^{-t}$. In $(2)$, $(1/2)_n$ is the following sequence $(1/2)_0 = 1$ and $(1/2)_n = (1/2)(1/2 + 1)\cdots(1/2 + n - 1)$. In $(3)$, we have 
$$
\int_0^{\infty}t^me^{-(2n+1)t}dt=\frac{m!}{(2m+1)^{m+1}}
$$
Now taking $m = 2$, we arrive at
$$
\int_0^{\pi/2}\log^2(\sin(x))dx = 2\sum_{n=0}^{\infty}\frac{(1/2)_n}{n!(2n+1)^{3}}
$$
A: Complex approach different from robjohn's link in the comments to the OP. From the basic trig identity $\sin(x) = \frac{e^{ix}-e^{-ix}}{2i}$, we can write $-2i\sin(x) = e^{ix}(e^{-ix}-e^{ix}) = 1 - e^{2ix}$. If we consider the contour I mention here, there will be no poles in the contour. By Cauchy's integral formula, the integral over the contours will be zero.
\begin{align}
\log(1-e^{2ix}) &= \log[e^{ix}(e^{-ix}-e^{ix})]\\
&= ix + \log(2) - \frac{\pi}{2}i+\log(\sin(x))
\end{align}
Then we can write the integral as (where I dropped the imaginary parts since we are solving a real integral)
\begin{align}
\int_0^{\pi/2}\Bigl[ix + \log(2) - \frac{\pi}{2}i+\log(\sin(x))\Bigr]^2
&=\int_0^{\pi/2}\Bigl[x^2-\pi x+\frac{\pi^2}{4}-\log^2(2)-2\log(2)\log(\sin(x))-\log^2(\sin(x))\Bigr]dx\\
\int_0^{\pi/2}\log^2(\sin(x))dx &=\int_0^{\pi/2}\Bigl[x^2-\pi x+\frac{\pi^2}{4}-\log^2(2)-2\log(2)\log(\sin(x))\Bigr]dx
\end{align}
As mentioned in the OP or in the link above, we already know $\int_0^{\pi/2}\log(\sin(x))dx=-\frac{\pi}{2}\log(2)$. Therefore, the RHS becomes
$$
\frac{\pi^3}{24}+\frac{\pi}{2}\log^2(2)
$$
