The following is invalid, since the operation is not defined when $a, b < 0$: $\sqrt{-1}\sqrt{-1} = \sqrt{(-1)(-1)} = \sqrt{(-1)^2} = \sqrt{1} = 1$. This is not correct, because $ii = -1$. This shows that $\sqrt{a}\sqrt{b} = \sqrt{ab}$ is invalid when $a, b< 0$.
However, say we have $\sqrt{-5}$. In order to simplify this, we do the following: $\sqrt{-5} = \sqrt{(-1)(5)} = \sqrt{-1}\sqrt{5} = i\sqrt{5}$. Why is this a valid manipulation given the previous statement that $\sqrt{a}\sqrt{b} = \sqrt{ab}$ is invalid when $a, b< 0$?