Observe that $\displaystyle\frac a{\left(\dfrac bc\right)}=\frac{ac}b,$ but $\displaystyle\frac {\left(\dfrac ab\right)}c=\frac a{bc}$
Here,
$$\frac Q{1+\dfrac wr}=\frac Q{\dfrac{r+w}r}=\frac{Qr}{r+w}$$
$$\implies w\left(\frac Q{1+\dfrac wr}\right)^2=\frac{Q^2r^2w}{(r+w)^2}$$
Similarly, $$r\left(\frac Q{1+\dfrac rw}\right)^2=\frac{Q^2rw^2}{(r+w)^2}$$
Adding we get, $$\frac{Q^2rw^2+Q^2r^2w}{(r+w)^2}=\frac{Q^2rw(r+w)}{(r+w)^2}=\frac{Q^2rw}{(r+w)}$$
Now divide the numerator & the denominator by $rw$
Also, observe that the question itself has assumed that $rw(r+w)\ne0$