Correlation between Sin and Square wave
Note that the second half of the period of the sinusoid is simply equal to the first half times $-1$. Since the same is true for the square wave, the multiplication of the two is the same in both intervals $[0,T/2]$ and $[T/2,T]$. That's why the integral over the whole period equals twice the integral over the first half of the period.