Conflicting thoughts with contour integrals. Say we are given a circle centered at the origin with radius 2, and are given the function $f(z) = \frac{z^2}{1-z^2}$. I was told that this integral is equal to 0 because both poles are inside the curve. I thought the opposite was true, where the integral is only equal to 0 if the poles lie outside the curve?
For another example using the same function, but with the circle being centered at z = 1 and radius of 1.5, one pole lies inside the curve and the other lies outside. So doing this one I can say $\int_{C} \frac{z^2}{(1-z)(1+z)}dz = \int_{\gamma} \frac{\frac{z^2}{1+z}}{1-z}dz = 2\pi i f(a)$ where a = 1 and $f(z) = \frac{z^2}{1+z}$.
So then this would become $2\pi i \frac{z^2}{1+z}$ and letting z -> 1 it becomes $2\pi i \frac{1}{2} = \pi i$.
I feel like I did the second one correctly and that the person who told me about the first one is wrong. Are both of these correct, both incorrect, or otherwise? Am I missing something here? It seems very basic so I'm not sure how the first one could be 0 based on what we were told in class.
 A: $$
\begin{align}
\int_C\frac{z^2}{(1-z)(1+z)}\,\mathrm{d}z
&=\frac12\int_C\left(\frac1{z+1}-\frac1{z-1}-2\right)\mathrm{d}z
\end{align}
$$
The residue of $\frac1{z+1}$ is $1$ and the residue of $-\frac1{z-1}$ is $-1$. Therefore, the integral along a counterclockwise $C$ is $2\pi i$ times the sum of the residues contained inside $C$.
I am not sure what the $2\pi af(a)$ represents in your answer.
A: You are right in what you think about the principle to take into account all poles inside the closed curve. However, sometimes it is convenient to consider the Riemann sphere where $\infty$ is just another possible singularity for a meromorphic function, and if all other singularities are inside the curve, we can calculate the integral by a single residue at infinity. In particular, if the function has a decay as $1/z^2$ the residue there is zero. 
Let's see how it works on your example. The function is
$$
\frac{z^2}{1-z^2}=-1+\frac{1}{1-z^2}
$$
so
$$
\int_{|z|=2}\Big(-1+\frac{1}{1-z^2}\Big)\,dz=\int_{|z|=2}\frac{1}{1-z^2}\,dz
$$
because $-1$ has no singularites inside the circle. The last integral has all singularities inside the circle. Let's change the variable $z=1/w$, so that all singularities will move outside. We get
$$
\int_{|z|=2}\frac{1}{1-z^2}\,dz=\int_{|w|=1/2}\frac{1}{1-\frac{1}{w^2}}\Big(-\frac{1}{w^2}\Big)\,dw=-\int_{|w|=1/2}\frac{1}{w^2-1}\,dw.
$$
The last integral is zero as the function is analytical inside the circle of itegration. Note that this inside was outside before the variable change.
P.S. It was important that the function had fast enough decay at $\infty$ to compensate $w^2$ in
$$
dz=-\frac{1}{w^2}\,dw
$$
otherwise we would get a singularity at $w=0$ with a possibly nonzero residue.
