Integrals of fractions(Complex) I'm a bit clueless about some (presumably basic) complex integrals. 
How would I integrate (over a circle centered at the origin, let's say of radius 2) things like  $\frac{1}{z^2+z+1}$ or $\frac {1}{z^2+2z-3}$? I know nothing beyond Cauchy's integration formula.
 A: $z^2+2z-3=(z+3)(z-1)$  So, 
$$\frac{1}{z^2+2z-3} = \frac14 \left(\frac{1}{z-1}-\frac{1}{z+3}\right)$$
So, we have
$$\int_{C} \frac14 \left(\frac{1}{z-1}-\frac{1}{z+3}\right)dz$$
If you know Cauchy's integral formula, then you know that the second term integrates to zero since it is analytic in, and on, $C$.  
Note that we could have integrated the integral of $\frac{1}{z-1}$ directly by using the complex logarithm after making a simple substitution.  However, caution needs to be applied as the complex logarithm is a multi-valued function and evaluation of $\log (2e^{i\pi}-1)=\log (3)+i\pi$ and $\log (2e^{-i\pi}-1)=\log (3)-i\pi$ on either side of the integration limits are obviously not the same.  For those unfamiliar with the complex logarithm, we proceed as follows.
For the integral of $\frac{1}{z-1}$, parameterize the circle $|z|=2$. Let $z=2e^{i\theta}$, $dz=2ie^{i\theta}d\theta$, and form the integral
$$\frac14 \int_0^{2\pi}  \frac{2ie^{i\theta}}{2e^{i\theta}-1}d\theta=\frac14 \int_{-\pi}^{\pi}  \frac{2ie^{i\theta}(2e^{-i\theta}-1)}{(2e^{i\theta}-1)(2e^{-i\theta}-1)}d\theta=\frac14 \int_{-\pi}^{\pi} \frac{2i(2-\cos \theta)}{5-4\cos \theta}d\theta$$
where the sine term integrated to zero because that integrand was an odd function of $\theta$.  
Now, let's work on the integrand a bit of the last term. It is easy to show that,
$$\frac{2-\cos \theta}{5-4\cos \theta}=\frac14 \left(1+\frac{3}{5-4\cos \theta}\right)$$ 
So, we now have 
$$\frac14 \int_{-\pi}^{\pi}  \frac{2ie^{i\theta}}{2e^{i\theta}-1}d\theta=i\frac{\pi}{4}+ i\frac{3}{8}\int_{-\pi}^{\pi} \frac {d\theta}{5-4\cos \theta}$$
The remaining integral has an integrand with a useful antiderivative, $\frac23 \arctan \left(3 \tan \left(\frac{\theta}{2}\right)\right)$  with $-\pi\le \theta \le \pi$.  Evaluating the integral yields 
$$\frac14 \int_0^{2\pi}  \frac{2ie^{i\theta}}{2e^{i\theta}-1}d\theta=i\frac{\pi}{4}+i\frac{\pi}{4}=i\frac{\pi}{2}$$
A: $$
z^2+z+1 = \left(z^2+z+\frac 1 4 \right) + \frac 3 4 = \left(z + \frac 1 2 \right)^2 +\frac 3 4 = \left(z+\frac 1 2 + i\frac{\sqrt 3} 2 \right)\left( z+\frac 1 2 - i\frac{\sqrt 3} 2  \right)
$$
The question now is whether the roots $\dfrac 1 2 \pm i \dfrac{\sqrt 3} 2$ are inside or outside the circle along which you're integrating.  Since $\left|\dfrac 1 2 \pm i\dfrac{\sqrt 3} 2\right| = 1 < 2$ and your circle has radius $2$, They're inside it.  So you have $\displaystyle\int_\gamma \cdots = (2\pi i\cdot\text{sum of residues})$.
