When can $\mathbb{N}$ (or any other set) be used as an exponent? Intuitively, you would say that if $\mathbb{N}²$ is the set of all vectors of two natural numbers, and correspondingly for $\mathbb{N}³$, then $\mathbb{N}^\mathbb{N}$ stands for the set of all vectors of any natural length (what is sometimes called $\mathbb{N}^*$). I've seen cases where this expression is used in a very different manner, like $2^\mathbb{N}$ for the power set, or $\mathbb{N}^\mathbb{N}$ for the functions from $\mathbb{N}$ to $\mathbb{N}$.
Is there a general way of using sets as exponents?
 A: I agree with Asaf that $\mathbb{N}^{\mathbb{N}}$ is terrible notation for the space of finite sequences of natural numbers. If you have sets, say $X$ and $Y$, and you see $Y^{\!X}$, it almost always denotes the set$^{\ast}\!$ of all functions from $X$ to $Y$. 
Even when you see the notation $2^{X}$ used for the power set of $X$, this is really just a clever way of expressing the power set using the other meaning for the notation. Think of $2$ as a set that contains two elements which we'll (cleverly) name $\mathrm{true}$ and $\mathrm{false}$. So if we have a function $f$ from a set $X$ to the set $\{\mathrm{true}, \mathrm{false}\}$, we can think of $f$ as representing a subset of $X$: every element sent to $\mathrm{true}$ is in the subset and every element sent to $\mathrm{false}$ is not in the subset. In this way there is a one-to-one correspondence between the functions of $2^X$ and all the subsets of $X$, so $2^X$ can be thought of as the power set of $X$.

$(\ast)$ There is a nit-picky subtlety here. When one writes $Y^{\!X}$, this is usually considered to be a set of functions. Sometimes though, like in category theory, if $X$ and $Y$ are objects in some category, the set of morphisms (which are like functions only cooler) from $X$ to $Y$ is instead denoted $\hom(X,Y)$, and the notation $Y^{\!X}$ is reserved to denote something a little more sophisticated called an exponential object in that category.
A: $Y^X$ generally indicates the space of all maps from $X$ to $Y$.
The $2^X$ notation is simply a shorthand for the powerset $\mathcal{P} (X)$. It came from the fact that $|2^X| = 2^{|X|}$ for any finite $X$.
A: As others have explained, $\mathbb{N}^\mathbb{N}$ and $\mathbb{N}^*$ are different. Nonetheless, they can be viewed as special cases of the same underlying idea as follows:

Definition 0. By a slate, lets mean a set $X$ equipped with a collection of subsets deemed supportive; so kind of like a topological space, but with the phrase "open subset" replaced by "supportive subset", and with no conditions imposed on the collection of supportive subsets.
Definition 1. Given a set $Y$ and a slate $X$, write $Y^X$ for the set of all functions $f$ such that there exists a supportive subset $S$ of $X$ satisfying $f : Y \leftarrow S$.

Then:

*

*Each set $X$ can be made into a slate by regarding $X$ as the only supportive subset. Under this identification, $Y^X$ just means the set of all functions $Y \leftarrow X$.

*Letting $*$ denote the slate whose underlying set is $\mathbb{N}$, and whose supportive subsets are precisely the lowersets that are bounded above, we see that $Y^*$ can indeed be identified with the set of words in $Y$.

*More generally, each ordinal $\alpha$ can be made into a slate $<\alpha$ by taking supportive subsets to be precisely the lowersets that are bounded above. This allows us to write $Y^{<\omega}$ for the set of words in $Y$.

