Understanding the units of number density I understand that we can measure any general number density $n$ as,
$$ n = \frac{N}{V}$$
for total number $N$ and volume $V$. This puts the units of number density as $\text{length}^{-3}$ e.g. $\text{cm}^{-3}$
Now suppose the number density varies with radius as e.g.,
$$ n(r) = N_0 r^{-2}$$
Clearly the units at any particular radius are still $\text{cm}^{-3}$, but then what are the units of $N_0$ and $r$?. It seems to me that for different distributions e.g. $N_0 r^{-3}$ the units would be different. But then how can the units of $n$ always be $\text{cm}^{-3}$
 A: Because you need a constant of proportionality with units such that it yields the correct units for $n$. Often this constant is absorbed in the units in which $r$ is measured. For instance, the expression
$$
n(r) = N_0 \left( \frac{r}{r_0} \right)^{-2}
$$
is equivalent to
$$
n(r) = k N_0 r^{-2}
$$
with the constant $k \equiv r_0^2$ having dimensions of $L^2$.
Note though that this functional form for the density profile strictly speaking is unphysical as it diverges for $r\rightarrow0$.
A: Number density is always what you stated $\mathrm{m}^{-3}$ and radius is physical length always $\mathrm{m}$, then you just have to solve the units of $N_{0}$. If $n = N_{0}r^{-2}$
$$ N_{0_\mathrm{units}} = \frac{\mathrm{m}^{-3}}{\mathrm{m}^{-2}} $$
You just know the dimension of length and number density. In equations that contain variables of unknown dimension you can just figure out this way what are their units.
A: In several comments, it was mentioned "just make the units of $N_0$ whatever they need to be, without concern as to why.  I thought I might add to that.
Units are a funny thing because in many cases, they serve no deeper purpose than to ensure you did the math correctly.  Take Hooke's law as a classic example.  Hooke's law is most accurately described in mathematics as $F\propto x$, where F is the force exerted by a spring is proportional to x, which is the amount the spring is extended or compressed.  However, this very pure form is inconvenient for doing math.  Instead we rewrite that equation as $F=kX$, where $k$ is a measure of the stiffness of the spring.  The two expressions convey the same information, but one uses proportionality while one uses equality and a constant multiplier.
When converting proportionality to equality, we have to deal with the fact that proportionality and equality differ in how they deal with units.  Proportionality is blind to units.  If you do the math, the units always end up canceling out.  Equality, however, does require the units to line up.  To make them line up we assign a unit to the constant which makes the equation work.
Sometimes we find that these assigned units have a deeper meaning, other times they do not.
So in your case, you write $n(r)=N_0r^2$, but in words you chose to write "...the number density varies with radius," which is a proportionality phrasing $n(r)\propto r^2$.  $N_0$ only appears as a side effect of turning that proportionality into an equality, and thus the units of $N_0$ are safely assigned to "whatever they need to be to make the units work."  This also points out the answer to your second question: if you used a distribution where $n(r)\not \propto r^2$, then you would have a different equation when you converted it to equality.  Thus, you would need to make up a different unit.
A: So $r$ has units of length, for example $\mathrm{m}$, so $r^{-2}$ has units $\mathrm{m}^{-2}$. to remain dimensionally consistent $N_{0}$ would have to have units $\mathrm{m}^{-1}$. Note that here, we have number density in 3 dimensions, giving a number per unit volume. We might imagine number density on the plane, or on a line. In this circumstance, the dimension of $N_0$ would change. It might be of interest to you to note that $N_0$ in this case is only a dimensionless number when the power law matches the dimension of the space we are considering. 
