why is $2^{\log^{2}\frac{1}{2}} = 1/2$? I have no understanding of $\log^2n$, wouldn't $2^{\log^{2}\frac{1}{2}} = 1/4$ since $2^{\log\frac{1}{2}} = 1/2$?
$\log$ here has the base of $2$.

$\textbf{Remark}$: Note that we have that $(a^b)^2 = a^{2b}$ and $a^{(b^2)} = a^{b^2}$, but in general we have that 
$$a^{b^2} \neq a^{2b}$$ (unless $b^2 = 2b$, which is only true for $b = 2$ and $b = 0$).
(Consider for example $(2^3)^2 = 2^(3 \cdot 2) = 2^6 = 64$, whereas $2^{(3^2)} = 2^9 = 512$). 
In your case, we have $a^{b^2}$ and with this in mind, we find
$$\log(\frac{1}{2}) = \log(1) - \log(2) = 0 -1 = -1,$$ 
since we work in base $2$ and therefore 
$$2 ^{\log^2(\frac{1}{2})} = 2^{(-1)^2} = 2^1 = 2.$$
