multiple sets of complex roots of a number? I am not sure if this question was asked before but I couldn't find the right keywords to choose for searching.  
So today I discovered a weird problem:
If we take this equation: $$x^2=1=e^{(0i)}$$
this equation has 2 solutions : $\{1, -1\}$
Until now everything is normal.
but if we wroted like this: $$x^2=x^{\frac{4}{2}}=\sqrt{x^4}=1$$
what happens is that this becomes: $x^4=1^2=1$
and now it has another set of roots: $\{1,-1,i,-i\}$
And we can continue as much as we want getting an infinite number of sets of roots
My question is how is this happening?
Did I make an illegal operation?
Did I miss something?
P.S.: I am not a mathematician, so I could have missed something here (that I probably didn't learn)  
UPDATE
My most important reason for asking is how to deal with equations like this: $$x^{\frac{a}{b}}=c$$ where a and b are 2 integers and you can simplify $\frac{a}{b}$
UPDATE
Obviously i and -i are not solution for $x^2=1$
But if we had from the beginning this equation: $x^\frac{4}{2}=1$ (which is exactly the problem I am waiting for its solution as I mentioned in my previous update above)
we have 2 options simplify to $x^2=1$=>we have only two roots
or do not simplify=>we have four roots and they are all valid: $i^\frac{4}{2}=\sqrt{1^4}=1$ (valid)  
so 2 sets of roots
tl;dr: to simplify or not to simplify? 

Certain exponent laws and properties go out the door when you start dealing with complex numbers. That's why you're getting to different solutions when going about this in two different way. 
In general, if $n$ is an integer, then the solution set to the problem $z^n = 1$ is the set of roots
$\{1=e^{2\pi i * (0/n)},e^{2\pi i * (1/n)},e^{2\pi i * (2/n)},\ldots,e^{2\pi i * ((n-1)/n)}\}$
