Why does $2^{O(\log n)} = n^{O(1)}$ hold?
This is simple math. An expression of the type $O(\log n)$ is at most $C\log n$ for some $C &gt; 0$ and large enough $n$. So for large enough $n$, the entire expression $2^{O(\log n)}$ is at most
$$
2^{C\log n} = n^C = n^{O(1)}.
$$
The first equation follows from the definition of the logarithm $2^{\log n} = n$, which in this case I conveniently assumed is taken to the base 2 (though it makes no difference in this case – can you see why?).