part b.
The function w=f(z) is analytic throughout the region bounded by C and the
reversals of C1 and C2 (shaded pink above) -- and hence the integral of f(z)
over C equals the sum of the integrals of f(z) over C1 and C2.
>
Factor the denominator
> fn:=factor(denom(w),I);
and rewrite the integrands suitably as
>
w=g[1](z)/op(3,fn);
w=g[2](z)/(fn/op(3,fn));
where
>
g[1](z):=simplify(numer(w)/fn*op(3,fn));
g[2](z):=simplify(numer(w)/fn*op(2,fn));
are analytic throughout one of the two small disks, respectively.
Using Cauchy's integral formula yields
>
z1:=solve(op(3,fn)=0,z);
z2:=solve(op(2,fn)=0,z);
>
J[C[1]]:=2*Pi*I*subs(z=z1,g[1](z));
J[C[2]]:=2*Pi*I*subs(z=z2,g[2](z));
and hence the original integral equals
> J[C]=J[C[1]]+J[C[2]];