Ok I get that $$\left(\sqrt x\right)^2 = x$$ and $$\sqrt{x ^2} = |x|.$$
I can explain this to myself when I insert $-1$ for $x$. With complex number $i$ I obtain those solutions. Fine.
Now when we have the power rules $$\left(b^m\right)^n = b^{m n}.$$
Now we can write $\sqrt x = x^{1/2}$. Thus, $\left(\sqrt x\right)^2 = x^{1/2 \ 2}$ but then $\sqrt{x ^2} = x^{2 \ 1/2}$.
So my question is, is $x^{2/2}$ equal $x$ or $|x|$ and why?
Let us start with the final question. The answer is $x^\frac22=x^1=x$.
However, you should not use the notation $\sqrt x$ when $x\in\mathbb{C}\setminus(0,+\infty)$, because then $x$ has two square roots and it is, in general, not clear which one is the one that you have in mind. On the other hand, if we accept that $\sqrt x$ is some square root of $x$, then it is trivial that $\sqrt x^2=x$.
But if $x\notin\mathbb R$ then no square root of $x^2$ is equal to $\lvert x\rvert$. So, I suggest that you don't write that $\sqrt{x^2}=\lvert x\rvert$, unless $x\in\mathbb R$.