The elementary calculations in the answers are not complete, because the justifications of interchanging of integration and differentiation, interchanging double sums are easy but non-trivial. At least some words about it, details can be left to the reader :-)
–
vesszaboAug 29 '12 at 16:26

I believe the C has something to do with the gamma constant, $\gamma$?. Because $psi(1/2)=-\gamma-2ln(2)$. This would then result in cancellations leaving only $\frac{{\pi}^{3}}{24}+\frac{\pi}{2}ln^{2}(2)$. Am I correct Sasha?. I like your solution. Very clever. Though, I must admit, the differentiation of the Gamma has me a little stymied. I will have to work through it.
–
CodyAug 20 '11 at 17:54

I ran through the differentiation and got: $\frac{{\pi}^{3}}{24}+\frac{\pi}{8}(\psi(1/2))^{2}+\frac{\pi \gamma}{4}\psi(1/2)+\frac{\pi {\gamma}^{2}}{8}$, which equals the correct result after simplifying. Very nice method, S.
–
CodyAug 20 '11 at 18:21

Here is a completely different way to approach this integral, which relies on some elementary complex analysis (Cauchy's theorem). It is based on an approach which I have seen several times employed to compute $\int_0^{\pi/2}\log{(\sin{x})}\,dx$ (particularly, in Ahlfors's book).

The idea is to integrate the principal branch of $f(z) := \log^2{(1 - e^{2iz})} = \log^2{(-2ie^{iz}\sin{z})}$ over the contour below, and then let $R \to \infty$ and $\epsilon \to 0$.

First of all, $1 - e^{2iz} \leq 0$ only when $z = k\pi + iy$, where $k$ is integral and $y \leq 0$. Thus, in the region of the plane which is obtained by omitting the lines $\{k\pi + iy: y\leq 0\}$ for $k \in \mathbb Z$, the principal branch of $\log{(1-e^{2iz})}$ is defined and analytic. Note that, for each fixed $R$ and $\epsilon$, the contour we wish to integrate over is contained entirely within this region.

By Cauchy's theorem, the integral over the contour vanishes for each fixed $R$. Since $f(x + iR) = \log^2{(1 - e^{2ix}e^{-2R})} \to 0$ uniformly as $R \to \infty$, the integral over the segment $[iR,\pi/2 + iR]$ vanishes in the limit. Similarly, since $1 - e^{2iz} = O(z)$ as $z \to 0$, we have $f(z) = O(\log^2{|z|})$ for small enough $z$, which, since $\epsilon \log^2{\epsilon} \to 0$ with $\epsilon$, means that the the integral over the circular arc from $i\epsilon$ to $\epsilon$ vanishes as $\epsilon \to 0$.

Finally, the contribution from the bottom side of the contour, after letting $\epsilon \to 0$, is
$$
\begin{align*}
\int_0^{\pi/2} f(x)\,dx = \int_0^{\pi/2} \log^2{(-2ie^{ix}\sin{x})}\,dx,
\end{align*}
$$
and we know from the preceding remarks that the real part of this integral must vanish. For $x$ between $0$ and $\pi/2$, the quantity $2\sin{x}$ is positive. Writing $-ie^{ix} = e^{i(x - \pi/2)}$, we see that $x - \pi/2$ is the unique value of $\arg{(-2ie^{ix}\sin{x})}$ which lies in $(-\pi,\pi)$. Since we have chosen the principal branch of $\log{z}$, it follows from these considerations that $\log{(-2ie^{ix}\sin{x})} = \log{(2\sin{x})} + i(x-\pi/2)$, and therefore that
$$
\begin{align*}
\text{Re}{f(x)} &= \log^2{(2\sin{x})} - (x-\pi/2)^2 \\
&= \log^2{(\sin{x})} + 2\log{2}\log{(\sin{x})} + \log^2{2} - (x - \pi/2)^2.
\end{align*}
$$
By setting $\int_0^{\pi/2} \text{Re}f(x)\,dx = 0$ we get
$$
\begin{align*}
\int_0^{\pi/2} \log^2{(\sin{x})}\,dx &= \int_0^{\pi/2}(x-\pi/2)^2\,dx - 2\log{2}\int_0^{\pi/2} \log{(\sin{x})}\,dx -\frac{\pi}{2}\log^2{2} \\
& = \frac{1}{3}\left(\frac{\pi}{2}\right)^3 + \frac{\pi}{2} \log^2{2}
\end{align*}
$$
as expected

By similar methods, one can compute a variety of integrals of this form with little difficulty. Here are some examples I have computed for fun. All are proved by the same method, with the same contour, but different functions $f$.

Related to this question of yours (which incidentally led me here), one can show by taking $f(z) = \log^4(1 + e^{2iz})$ and comparing real parts that
$$
\int_0^{\pi/2} x^2\log^2{(2\cos{x})}\,dx = \frac{1}{30}\left(\frac{\pi}{2}\right)^5 + \frac{1}{6}\int_0^{\pi/2} \log^4{(2\cos{x})}\,dx.
$$
Assuming the result of the other question, we then get
$$
\int_0^{\pi/2} \log^4{(2\cos{x})}\,dx = \frac{19}{15}\left(\frac{\pi}{2}\right)^5.
$$

Actually, the integral in 3. has several interesting series expansions, and I would be very interested if someone could compute it without using the result from the question I cited. For one thing, that would give us a different proof of that result (which is why I started investigating it in the first place).

Actually, to add to the examples listed above, I believe one can show that $$\int_{-\pi/2}^{\pi/2}\left(\log(2\cos{x}) + ix\right)^m\,dx =0$$ for all integers $m>0$, by taking $f(z) = \log^m(1 + e^{2iz})$ and integrating instead over the rectangle with vertices $-\pi/2 + Ri$, $-\pi/2$, $\pi/2$. (Of course, the corners must be omitted as before, but this should be a nonissue.) With this choice of contour, the contributions from the vertical sides will actually cancel.
–
Nick StrehlkeMar 15 '12 at 9:02