Complex integration by Cauchy's residue theorem 
Evaluate the following integral by Cauchy's Residue Theorem
$$\int_C\frac{2z^2-z+1}{(2z-1)(z+1)^2}\,dz$$where , $C:r=2\cos \theta$  , $0\le \theta \le \pi.$

I have problem about the contour $C$.
Here, $r^2=4\cos^2 \theta=\frac{4x^2}{x^2+y^2}$ , as $\tan \theta =y/x$.
Then , $x^2+y^2=\frac{4x^2}{x^2+y^2}\implies x^2+y^2=\pm 2x\implies (x\pm 1)^2+y^2=1$. Thus we get two semicircles, which we take for the integration and why?

$$\int_{C}\frac{2z^2-z+1}{(2z-1)(z+1)^2}dz$$$$=\frac{1}{2}\int_{C}\frac{2z^2-z+1}{\left(z-\frac{1}{2}\right)(z+1)^2}dz$$
We see that the singularities $z=\frac{1}{2}$ & $z=-1$ are on the real axis inside the curve, $C: r=2\cos \theta$ hence there are the poles of first & second order respectively. Let's find out the residues at these poles as follows 
$\color{red}{\text{Residue at}\ z=\frac{1}{2}}$
$$Res\left(f(1/2)\right)=\lim_{z\to \frac{1}{2}} \frac{2z^2-z+1}{(z+1)^2}$$ $$=\frac{2\left(\frac{1}{2}\right)^2-\frac{1}{2}+1}{\left(\frac{1}{2}+1\right)^2}=\frac{4}{9}$$ $\color{red}{\text{Residue at}\ z=-1}$
$$Res\left(f(-1)\right)=\lim_{z\to {-1}}\frac{d}{dz}\left(\frac{2z^2-z+1}{z-\frac{1}{2}}\right)$$ $$=\lim_{z\to {-1}}\left(\frac{\left(z-\frac{1}{2}\right)(4z-1)-(2z^2-z+1)(1)}{\left(z-\frac{1}{2}\right)^2}\right)$$   $$=\frac{\left(-1-\frac{1}{2}\right)(4(-1)-1)-(2(-1)^2-(-1)+1)}{\left(-1-\frac{1}{2}\right)^2}=\frac{2}{3}$$
Hence, using Cauchy Residue theorem, we get $$\frac{1}{2}\int_{C}\frac{2z^2-z+1}{\left(z-\frac{1}{2}\right)(z+1)^2}dz=\frac{1}{2}(2\pi i)\left(Res(f(1/2))+Res(f(-1))\right)$$ $$=\pi i\left(\frac{4}{9}+\frac{2}{3}\right)=\color{}{\frac{10\pi i}{9}}$$ $$\bbox[5px, border:2px solid#C0A000]{\int_{C}\frac{2z^2-z+1}{\left(2z-1\right)(z+1)^2}dz=\color{blue}{\frac{10\pi i}{9}}}$$
