How to combine complex powers?
Solution 1:
For complex numbers the general way of defining $x^y$ (with $x$ nonzero) is as $\exp(ly)$ where $l$ is one of the logarithms of $x$. But $x$ does not have a unique logarithm, it has many. If $l$ is one logarithm of $x$ then the general one is $l+2n\pi i$ with $n$ an integer. Hence the general value of $x^y$ is $$\exp(ly+2\pi iny)=\exp(ly)\exp(2\pi i ny).$$
Before proceeding further note that if $y$ is an integer then $\exp(2\pi i ny)=1$ so that $x^n$ is uniquely determined. More generally if $y$ is a rational with denominator $d$ then $\exp(2\pi i ny)$ (and so $x^y$) takes $d$ different values. But if $y$ is irrational, then $x^y$ takes infinitely many variables.
In the problem in hand $x^y$ takes the values $\exp(ly)\exp(2\pi i ny)$ as above, and $x^{yz}$ the values $$\exp(lyz)\exp(2\pi inyz).$$ However in general each value of $x^y$ gives rise to infinitely many values of $(x^y)^z$, namely $$\exp((ly+2\pi iny)z+2\pi i mz)$$ so $(x^y)^z$ has a "doubly-infinite" family of values. In general, there will be values of $(x^y)^z$ which are not values of $x^{yz}$ so the "paradox" in the previous posting should be expected.
Solution 2:
The original question asked about a theory that would make this all work out correctly. The previous answers are all correct, but they did not point out the underlying, unifying factor which makes all these computations much simpler: the Unwinding number. The unwinding number $\mathcal{K}(z)$ is defined to be $$ \ln(\exp(z)) = z + 2\pi i\mathcal{K}(z).$$ It is an integer which tells you how many times you need to 'unwind' $z$ before you get into the range where $\ln\circ \exp$ is the identity. This then allows a lot of identities to be 'fixed' with relative ease.
I also find the paper Reasoning about the Elementary Functions of Complex Analysis by Corless, Davenport, Jeffrey, Litt and Watt quite instructive in this domain.
Solution 3:
Since people keep hearing about Riemann surfaces in the three threads thus far about complex exponentiation and the logarithm being multivalued, but are probably wondering about the multivalued part, here's a visualization courtesy of Michael Trott:
This is a plot of the logarithm's imaginary part over the complex plane. Note the branch cut running through the negative real axis. Analytic continuation consists of joining together copies of this cut surface above and below (corresponding to adding or subtracting integer multiples of $2\pi i$) and matching up the cuts of each piece to maintain continuity, thus:
The surface on the right is the analytically continued imaginary part.
(images from here)
Solution 4:
I guess the problem in general arises because $a^b$ can have multiple values. We have $$\begin{eqnarray} \log((x^y)^z) & = & z(\log(x^y)+2\pi im)=z(y(\log(x)+2 \pi in)+2\pi im)\\ & = & zy\log(x)+2\pi i(ny + m)z\\ & = & \log(x^{yz}e^{2\pi i(ny + m)z}) \end{eqnarray}$$
It seems a correction factor of $e^{2\pi i(ny + m)z}$ is necessary.
So all that can be said is that $\exists m,n\in\mathbb{Z}:(x^y)^z=x^{yz}e^{2\pi i(ny + m)z}$.
In particular, we can say that the correction term is 1 if $(ny+m)z$ is always an integer, which happens for example if we know $y,z\in\mathbb{Z}$.