On the integral of $e^{aix}$. I've been trying a simple trick, but I'm unsure as to why it is failing. Let's say I wanted to compute $ \int^{\pi} _{ - \pi} e^{aix} dx$ for some constant a.
Why won't this trick work?
$ \int^{\pi} _{ - \pi} e^{aix} dx \\ = \left[ \frac{1}{ai} e^{aix} \right]^{\pi} _{- \pi} \\ = \left[ \frac{1}{ai} (e^{ix})^a \right]^{\pi} _{- \pi} \\ = \frac{1}{ai}(-1)^a - \frac{1}{ai}(-1)^a \\ =0$
 A: You obviously know there is an issue - as Henry W wrote, the problem is in the manipulation of exponents. It might be easier to take a specific  'bad'  $a$, say $a = 1/2$, to see what's going on.
Then, your integral becomes
$$ \int_{-\pi }^\pi e^{ix/2}\, dx = -2\,i\ \left ( e^{i\pi/2} - e^{-i\pi /2} \right)$$
Now, if we do it 'without simple tricks', the parentheses above become 
$$\left( \ (\,+i\,) - (\,-i\, ) \ \right).$$
Now, if we try instead to use your equality $e^{za} = (e^z)^a$, with $z= \pm \pi i$, we have, as you wrote, $e^{\pm\pi i } =-1$, and we are left with evaluating $(-1)^{1/2}$ - but there are two possible candidates: $+i$, and $-i$.
To   evaluate the integral (correctly), one needs to make opposite choices - and NOT the same choice, as your argument would suggest, e.g., 
$$ \left( \ (\,+i\,) - (\,+i\, ) \ \right).$$
So, except for $a$ an integer, your 'simple trick' isn't so simple.
There is quite a bit more to say about this...  For instance, what does one mean by  $e^z$? Namely, if $(-1)^{1/2}$ is problematic, why shouldn't $e^z$ be just as bad? Of course in the first case, we have a problem because there are two choices for the square root of $-1$, but at least we know what they are! But what does $(-1)^a$ mean for arbitrary $a$?  (For fractional values of $a$, the problem is much the same as for the $1/2$, but for arbitrary $a$ - it's worse....)
Typically, one defines a power series  $$\exp z = \sum_{n=0}^\infty z^n/n!,$$ which converges for any (complex) $z$, and is a well-defined function - i.e., given $z$, the power series evaluates to one, and just one, complex value - i.e., $\exp$ is a function. We then, you might say, fudge a little bit, and WRITE 
$$ e^z = \exp z,$$
that is, the left hand side is short-hand for the right hand side.
In any event, with this definition, we know what we mean by $e^z$, for any complex number, and it matches up with what we understood with $z$ a real number.
But what about $u^v$? You might try to define $$ u^v =  \exp \left (v \ln u\right),$$
but you are left with defining $\ln u$. For positive $u$, you're OK, but in general, it's not so obvious.
One might try a power series definition:
$$ \ln \left( 1 - z \right) = - \sum_{n=1}^\infty z^n/n,$$
but that power series has a radius of convergence of $1$ - i.e., it doesn't make sense with $|z| > 1$. In particular, in your case, where $u= -1$, one would have to take $z= 2$, so no go...
Now, from what I've written, it seems like I'm implying that nothing works... That is not so.  For instance you can say that your question does give a consistent definition of $z^{a}$ along the unit circle minus the point $-1$ (that is, without the end points of integration) - i.e. $z^a = e^{ia\theta}$, where $\theta$ is the argument in $(-\pi,\pi)$.   Again, there is a more to say in the general case (or, at least, complex analysis has more to say), but I hope this gives an idea that care is warranted... Hope this helps.
A: 
Assume $a\in\mathbb{R}$:

$$\int_{-\pi}^{\pi}e^{axi}\space\text{d}x=\int_{-\pi}^{\pi}\exp[axi]\space\text{d}x=$$

Substitute $u=axi$ and $\text{d}u=ai\space\text{d}x$.
This gives a new lower bound $u=-a\pi i$ and upper bound $u=a\pi i$:

$$\frac{1}{ai}\int_{-a\pi i}^{a\pi i}\exp[u]\space\text{d}u=\frac{1}{ai}\left[\exp[u]\right]_{-a\pi i}^{a\pi i}=$$
$$\frac{1}{ai}\left(\exp[a\pi i]-\exp[-a\pi i]\right)=\frac{\exp[a\pi i]-\exp[-a\pi i]}{ai}=\frac{2\sin(a\pi)}{a}$$
A: This can also be solved by expressing $e^{iax}$ in terms of trigonometric functions. Since $e^{aix} = \cos(ax) + i\sin(ax)$, we have
$$\begin{aligned}
\int_{-\pi}^{\pi}e^{aix} dx &= \int_{-\pi}^{\pi}\cos(ax) dx + i \int_{-\pi}^{\pi}\sin(ax) dx \\
&= \int_{-\pi}^{\pi}\cos(ax) dx \\
\end{aligned}$$
We have used the fact that $\sin(ax)$ is an odd function, so its integral over any interval of the form $[-c,c]$ is zero.
Also, $\cos(ax)$ is an even function, so
$$\int_{-\pi}^{\pi}\cos(ax) dx = 2\int_{0}^{\pi}\cos(ax) dx$$
If $a=0$, then
$$2\int_{0}^{\pi}\cos(ax) dx = 2\int_0^{\pi} (1) dx = 2\pi$$
Otherwise,
$$2\int_{0}^{\pi}\cos(ax) dx = 2\left.\frac{\sin(ax)}{a}\right|_{0}^{\pi} = 2\frac{\sin(a\pi)}{a}$$
