Tricky operation involving complex numbers Consider the following chain of equations, where $n \in \mathbb{Z}, n \geq 3$:
$$
\mathbb{i}^{-n}\cdot 2^{n/2} = (\sqrt{-1})^{-n}\cdot 2^{n/2} =(-1)^{-n/2}\cdot 2^{n/2} = \frac{1}{(-1)^{n/2}} \cdot 2^{n/2} \, \mathrm{.}
$$
As far as I know, all of them are true. However, the following is not always true, according to Mathematica:
$$
\frac{1}{(-1)^{n/2}} \cdot 2^{n/2} = \left( \frac{2}{-1} \right)^{n/2} \, \mathrm{.}
$$
Why not??
Not a difficult question, I guess, but I cannot see why the last equation is either true or false depending on the value of $n$.
For instance, for $n=5$:
$$
\frac{2^{5/2}}{(-1)^{5/2}}=-\left(-\frac{2}{1}\right)^{5/2}  \, \mathrm{,}
$$
while, for $n=6$:
$$
\frac{2^{6/2}}{(-1)^{6/2}}= \left(-\frac{2}{1}\right)^{6/2} \, \mathrm{.}
$$
I thought that the equivalence
$$\frac{a^m}{b^m} = \left( \frac{a}{b} \right)^m $$
was universally true, but it seems that it only works with real numbers?
 A: $\sqrt{xy}=\sqrt{x}\sqrt{y}$ only applies when $x,y$ are positive numbers.  It thus follows that $(\sqrt{xy})^n=(\sqrt{x}\sqrt{y})^n$ if and only if $x,y$ are positive numbers.  If not, this statement cannot be made.
The equivalence of $\frac{1}{{(-1)}^\frac{n}{2}}2^{n/2}=(\frac{2}{-1})^{n/2}$ cannot be stated here because $-1$ is negative.
So if $n$ is even, then $\frac{n}{2}$ is a whole number and you avoid the problem arising with taking a square root.  However, if not, then the equality will not hold.
A: As you (probably) know, when you take a complex number $z$ and elevate to a real power $s$ : $w=z^s$ you obtain a complex number $w$ that , in polar form has 
$|w|=|z|^s$ and $\angle w= s \angle z$.
But the angle $s \angle z$ get then reduced modulo $2\pi$.
That means that, in reversing  the operation, there are different values of $z$ for which $z^s=w\; \to \; z=w^{1/s}$, i.e. $z= |w|^{1/s} \exp(arg(w)/s + i 2k\pi/s)$.
Taking only one of them, the principal value which is the value programmed by default in the various CAS, does not allow you to do further "manipulations" if not carefully checking the conditions: thus the principal root of a product might well not be the product of the principal roots of the single terms.   
Read for example this Wikipedia article.
In particular $\sqrt{-1}= \pm i$, so $i=\sqrt{-1}$ is one of, the principal, roots.
But, taking only the principal value leads to incongruities:
$$
1 = \sqrt 1  = \sqrt {\left( { - 1} \right)\left( { - 1} \right)}  = \left( {\left( { - 1} \right)^{\,2} } \right)^{\,1/2} \quad  \ne \quad \sqrt {\left( { - 1} \right)} \sqrt {\left( { - 1} \right)}  = \left( {\left( { - 1} \right)^{\,1/2} } \right)^{\,2}  = i^{\,2}  =  - 1
$$
and (as happens in your example)
$$
\matrix{
   {{1 \over {\sqrt { - 1} }} = \left( {\left( { - 1} \right)^{\,1/2} } \right)^{\, - 1}  = {1 \over i} =  - i} & {\quad  \ne \quad } & {\sqrt {{1 \over { - 1}}}  = \sqrt { - 1}  = \left( {\left( { - 1} \right)^{\, - 1} } \right)^{\,1/2}  = i}  \cr 
 } 
$$
but that does not happens if we take all the roots, e.g.
$$
\matrix{
   {{1 \over {\sqrt { - 1} }} = 1\;e^{\, - \left( {i\pi /2 + ik\pi } \right)}  = e^{\, - i\pi /2 + ik\pi }  =  \mp i} & {\quad  = \quad } & {\sqrt {{1 \over { - 1}}}  = \sqrt { - 1}  = e^{\,\left( {i\pi  + i2k\pi } \right)/2}  =  \pm i}  \cr 
 }
$$
