How did they arrive at the following expression for vector projection?

Note that $\hat{w} = \vec{w}/\|\vec{w}\|$. (Perhaps you conflated $\hat{w}$ with $\vec{w}$ when reading the equations?)

In general, $z \langle \vec{a}, \vec{b}\rangle = \langle \vec{a}, \bar{z} \vec{b}\rangle$ for a complex scalar $z$. Since $1/\|\vec{w}\|$ is real, we have $\langle \vec{v}, \vec{w} \rangle / \|\vec{w}\| = \langle \vec{v}, \hat{w}\rangle$.