Why can arbitrary functions be substituted into Taylor Series? Say we have the function $(1+x)^{-1/2}$. 
Using a Taylor Series centered on $x_0=0$, its easy to see that: 
$$(1+x)^n\approx1-\frac{1}{2}x+\frac{3}{8}x^2+...\mathcal{O}(x^3)$$
In the above, $\mathcal{O}(x^3)$ just represents higher order terms. After understanding Taylor Series, I understand the above approximation.
However, in many Physics Textbooks, its common-place for the author to replace $x$ with whatever he feels like, and make the same approximation.
For example, in Purcell's E&M, when explaining multi-pole expansions he writes:
                     
However, while reading this, it occurred to me that I have never seen it explained why we can just replace any expression for $x$.
If someone could explain this, I'd really appreciate it! Thanks!

Here, perhaps this will help. Taylor's Theorem says:
$$f(x)\approx f(x_0)+f'(x_0)(x-x_0)+\frac{f''(x_0)(x-x_0)^2}{2}+...\mathcal{O}(x^3))$$
However, if we instead try to substitute in for $x$ some other function, say...$g(x)$, we couldn't just substitute in $g(x)-g(x_0)$ everywhere where there is an $(x-x_0)$ right? Or could we?
 A: Assuming we're talking about an approximation for small $x$, the expression $O(x^3)$ is understood to mean "a function of $x$ which behaves like $x^3$ as $x\to0$". More precisely, you can replace $O(x^3)$ literally by a function $R(x)$ such that $|R(x)/x^3|$ is bounded for all $x$ near zero. This is how you can read a statement such as:
$$(1-x)^{-1} = 1 + x + x^2 + O(x^3).\tag1$$
You are allowed to substitute in place of $x$ any expression that's a function of some other variable (say $t$), and infer an expansion in terms of $t$, as long as the expression is also "small", i.e., tends to zero as $t\to0$. For example $x:=t^2-2t$ qualifies. Substituting this into (1) and replacing $O(x^3)$ with $R(x)$ gives
$$
(1-[t^2-2t])^{-1}=1+[t^2-2t]+[t^2-2t]^2+R(t^2-2t).\tag2
$$
Expanding out the brackets on the RHS of (2), you will find terms in $t$ and $t^2$ ; the higher powers of $t$ can be abbreviated $O(t^3)$. And the rightmost term $R(t^2-2t)$ is also $O(t^3)$ as $t\to0$, since 
$$
\left|\frac {R(t^2-2t)}{t^3}\right|=\left|\frac{R(t^2-2t)}{(t^2-2t)^3}\right|\cdot\left|\frac{(t^2-2t)^3}{t^3}\right|\tag3
$$
where the first factor on the RHS is bounded (by definition of $R$) while the second term converges to a constant as $t\to0$. The boundedness of the first factor depends crucially on the fact that $t^2-2t$ tends to zero when $t$ tends to zero.
The conclusion is that as $t\to0$,
$$(1-[t^2-2t])^{-1} = 1 -2t + 2t^2+O(t^3).$$
You can see that these kinds of exercises can be quite tedious (and your textbooks will skip all the intermediate steps), but the calculations are mechanical -- just keep track of the exponents that appear when you expand. The whole idea of $O(\cdot)$ notation is to sweep all this fussiness under the rug. 
