What does $a^b$ mean? Notation $a^b$ seems to be ubiquitous in mathematics and I think that most of us take it for granted. But, at least to me, it seems that it means totally different things depending on the context. 
In terms of general algebraic structures, if $a$ is an element of a magma with product function $(a_1,a_2)\mapsto a_1\cdot a_2$ and $b$ is a positive integer, then
$$
a^b=\underbrace{a\cdot a\cdot a...\cdot a}_{b\mbox{ times}}
$$
If $a$ is an element of a monoid, then we usually say that $a^0=1$. If $a$ is an element of a group, then $b$ can be any integer.
However, over the field of reals, $a^b=\exp(b\log a)$, and we only allow $a>0$. When working over the field of complex numbers $a^b$ is not even a function. I'm sure that notation $a^b$ arises in other contexts as well.
Why do we use the same notation $a^b$ for operations which seem absolutely different?
 A: What $a^b$ means is irrevocably context dependent.
In lower level (i.e. computation-based) math classes $a^b$ usually means exponentiation.  It's true that exponentiation can be computed by repeated addition when $a,b$ are positive integers, but that's not what exponentiation "is."  The true definition has to do with logarithms - I won't build this from the ground up, because that's already done in many places (not the least obvious of which is Wikipedia, and I'm sure in other places on MSE).
However, that's assuming that $a$ and $b$ are real numbers.  If either are complex numbers, exponentiation is defined completely differently.  If $a$ and $b$ are matrices, there's another definition (in fact multiple definitions) for exponentiation of matrices.
It doesn't stop there.  $a^b$ may have nothing to do with exponentiation of any kind.  In group theory, when $a$ and $b$ are group elements, $a^b$ is just shorthand for group conjugation, i.e. $a^b=b^{-1}ab$.  We even write functions that way - $a^b$ could also mean $b(a)$, where $b$ is a function.
In other words, in higher mathematics, the meaning of $a^b$ entirely depends on what structure you're working in and which discipline of mathematics you're doing.  $a^b$ is a simple and easy notation, so it attracts redefinition.
A: I don't know the actual history, but if I had to make one up, I would suggest that it comes first from extending integer exponents to rational ones, and then taking the continuous extension.
e.g. compound interest. If you have \$100 and you earn 1% interest every year, then the amount of money you have after $n$ years is $\$100 \cdot 1.01^n$
But then your bank decides it's better to do things more evenly over the year, so it switches to compound interest quarterly, but still result in the same amount of interest after a whole year, then they take a fourth root. So you earn $.249...\%$ interest every quarter, and thus have $\$100 \cdot 1.00249...^n$ after $n$ quarters. This still works out to $\$100 \cdot 1.01^n$ every $n$ years; we just allow $n$ to come in increments of one-fourth.
But rather than a quarter, maybe they change their mind and do monthly. So then they have to take another cube root, so that you get $.082954...\%$ interest every month. This, of course, is still $\$100 \cdot 1.01^n$ every $n$ years, but we allow $n$ to come in increments of $1/12$.
Eventually, this pushes towards the idea of continuously compounded interest, and $n$ becomes an arbitrary real number. And $\$100 \cdot 1.01^n$ seems like the obvious notation for it.
The differences between the continuous and discrete exponentiation operations don't come up all that often. And when it does, it's not hard to treat it in an ad-hoc fashion (for better or worse -- IMO I think the distinction deserves to be paid much more attention than it actually is).
