Suppose we wished to calculate the value of $\int\limits_\gamma \frac{1}{z-1} \ dz$ where $\gamma$ is a circle of radius $\frac{1}{2}$ around $1$. We can parametrise it as $\gamma(\theta) = 1+\frac{1}{2}e^{i\theta}$. The residue theorem tells us that the integral equals $2\pi i$.
However we can expand $\frac{1}{z-1}$ as $-(1+z+z^2+\cdots)$ which is valid for $|z| < 1$; in fact this actually converges uniformly on compact subsets of this region. Choose a region containing the curve $\gamma$. Hence we can expand our integral out as $$2\pi i = \int\limits_\gamma \frac{1}{z-1} \ dz = -\int\limits_\gamma \sum\limits_{n=0}^\infty z^n \ dz = -\sum\limits_{n=0}^\infty \int\limits_\gamma z^n \ dz$$ by uniform convergence. Now note that for any $n$ we have $\int\limits_\gamma z^n \ dz = \int\limits_0^{2\pi} (1+\frac{1}{2}e^{i\theta})^n\frac{i}{2}e^{i\theta} \ d\theta$. Expanding out we see that each of our terms in the integral is some constant times $e^{ki\theta}$ where $k$ is an integer between $1$ and $n+1$. Hence the integral is a sum of terms of the form $e^{ki\theta}$ and putting in our boundary conditions gives us that $\int\limits_\gamma z^n \ dz = 0$ for any $n$. Hence our infinite sum is just a sum of $0$'s so has to be $0$ which contradicts the fact that it equals $2\pi i$.
This means I must have made a mistake somewhere but I can't find it. Any help with what I did wrong is much appreciated.