How do I expand $(1+x)^{1/x}$ for small $x$? The binomial expansion
$$(1+x)^{n} = 1 + nx + \frac{n(n-1)}{2}x^{2}+...$$
didn't work because of the $n$ term being undefined at $x=0$.
Taylor expansion doesn't work either since it too would depends on an undefined $1/x$ term.
How does one do it?

Let's consider the function
$$
f(x)=\begin{cases}
\dfrac{\log(1+x)}{x} & x>-1, x\ne0 \\[6px]
1 & x=0
\end{cases}
$$
Then $f$ is everywhere differentiable and its Taylor expansion at 0 is
$$
f(x)=1-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}+\dotsb
$$
Now we have $(1+x)^{1/x}=e^{f(x)}$ (with continuous extension at $x=0$), so we can apply the series for $e^x$.
Say we want to find the Taylor expansion up to degree $3$, for simplicity, so we need
$$
\exp\Bigl(1-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}+o(x^3)\Bigr)
$$
and we get
$$
e\Bigl(1-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}+\frac{1}{2}\Bigl(-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}\Bigr)^2+\frac{1}{6}\Bigl(-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}\Bigr)^3+o(x^3)\Bigr)
$$
and so
$$
e\Bigl(1-\frac{x}{2}+\frac{x^2}{3}-\frac{x^3}{4}+\frac{x^2}{8}-\frac{x^3}{6}-\frac{x^3}{48}+o(x^3)\Bigr)
$$
and, eventually,
$$
(1+x)^{1/x}=e-\frac{ex}{2}+\frac{11ex^2}{24}-\frac{7ex^3}{16}+o(x^3)
$$
