Is the square-root of $x^2$ not $x?$ What happened to $x^2$

My question is what happened to the yellow part of the equation, why does it disappear in the new line. I understand that if you take the square root of $x^2$ then it should be $x,$ but in the second line of equation we only have the sum of $xy$ with square-root of $n-1.$ Please provide a dummy explanation. Also if you have time, please explain the red part of the equation? 
Please be aware there is a picture attached. Please click on "What happened to $x^2$".   
 A: Here's what happened:
$$\frac{A}{C}\sqrt{\frac{B\cdot C\strut}{D}}=\frac{A}{C}\cdot\frac{\sqrt{B\strut}\cdot \sqrt{C\strut}}{\sqrt{D\strut}}=\frac{\sqrt{B\strut}\cdot  A}{\sqrt{C\strut}\cdot \sqrt{D\strut}}=\frac{\sqrt{B\strut}\cdot A}{\sqrt{C\cdot D\strut}}$$
where
$$\textstyle A=\sum x_iy_i\qquad B=n-1 \qquad C=\sum x_i^2\qquad D=\sum (y_i-x_i\beta)^2$$
Note that these steps are permitted and make sense since $A$, $B$, $C$, and $D$ are all non-negative.
A: In the equation you show we can define $\sum x_i^2=k$  The upper equation has $\sqrt k$ in the numerator and $k$ in the denominator.  The lower expression, whic should be equal to $t$ as well, has $\sqrt k$ in the denominator. As long as $k \gt 0, \frac {\sqrt k}k=\frac 1{\sqrt k}$ It was just brought into the square root sign.
A: $$\frac{\sum x_iy_i}{\sum x_i^2}\sqrt{\frac{(n-1)\sum x_i^2}{\sum(y_i-x_i \beta )^2}} = (\sum x_iy_i)\sqrt{\frac{(n-1)\sum x_i^2}{(\sum x_i^2)^2\sum(y_i-x_i \beta )^2}} = (\sum x_iy_i)\frac{\sqrt{(n-1)}}{\sqrt{(\sum x_i^2)\sum(y_i-x_i \beta )^2}}$$
The sum in the denominator was brought under the square root, then appropriate terms were cancelled in the fraction.
