For which complex $a,\,b,\,c$ does $(a^b)^c=a^{bc}$ hold?
If we agree $\log z$ has imaginary part between $-\pi$ and $\pi$ and is defined only on the set $D = \mathbf{C} \setminus(-\infty, 0]$, then \begin{align*} \exp(\log z) &= z\quad\text{for all $z$ in $D$,} \\ \log(\exp z) &= z\quad\text{for all $z$ with imaginary part between $-\pi$ and $\pi$.} \end{align*} If the imaginary part of $z$ is between $(2k - 1)\pi$ and $(2k + 1)\pi$, then $$ \log(\exp z) = z - 2\pi ki \tag{1} $$ because $z - 2\pi ki$ has imaginary part between $-\pi$ and $\pi$.
Defining $a^{b} = \exp(b \log a)$, we have \begin{align*} (a^{b})^{c} &= \exp\bigl(c \log(a^{b})\bigr) = \exp\bigl(c \log [\exp (b \log a)]\bigr), \\ a^{bc} &= \exp(bc \log a). \end{align*}
If $b \log a$ has imaginary part between $(2k - 1)\pi$ and $(2k + 1)\pi$, then $\log\bigl(\exp(b \log a)\bigr) = b \log a - 2\pi ki$ by (1), so $$ \exp\bigl(c \log(a^{b})\bigr) = \exp\bigl(c(b \log a - 2\pi ki)\bigr) = \exp(bc \log a) \exp(-2\pi cki), $$ which is equal to $a^{bc}$ if and only if $\exp(2\pi cki) = 1$.
In particular, if $b \log a$ has imaginary part between $-\pi$ and $\pi$ (i.e., $k = 0$), or if $c$ is an integer, then $$ (a^{b})^{c} = \exp\bigl(c \log(a^{b})\bigr) = \exp\bigl(c \log(\exp b \log a)\bigr) = \exp(bc \log a) = a^{bc}. $$