suppose $\gamma: [a,b] \rightarrow \mathbb{C} $ is a path of integration with $ \gamma(a)=0, \gamma(b)=1 \ and \ \pm i \notin\gamma([a,b]) $ Show that, $$ \int_{\gamma} \frac{1}{1+z^2} = \frac{\pi}{4} + k \pi $$
I would try to apply Cauchy's integral formula. Therefore i can split the integrand in partial fractions with singularities at $ \pm i$ How do i have to choose my contour such that it fullfilles the conditions at the beginning.
Let $\Gamma$ be another path: a straight line connecting from $1$ to $0$.
By residue theorem (let $n$ and $m$ be the winding numbers around $z=+i$ and $z=-i$ respectively),
$$ \begin{align} \oint_{\gamma+\Gamma}\frac{dz}{1+z^2} &=2\pi i \left(n\operatorname*{Res}_{z=i}\frac1{1+z^2}+ m\operatorname*{Res}_{z=i}\frac1{1+z^2}\right) \\ &=\pi(-n+m) \\ &=\pi(m-n) \end{align} $$
Since $$\int_{\Gamma}\frac{dz}{1+z^2}=\int^0_1\frac{dt}{1+t^2}=\operatorname{arctan}t\bigg\vert^{t=0}_{t=1}=-\frac{\pi}4$$
Thus, $$\int_{\gamma}\frac{dz}{1+z^2}=\frac{\pi}4+(m-n)\pi$$
Doing without residue theorem:
Firstly, recognize that $$\int\frac{dz}{1+z^2}=\frac1{2i}\int\left(\frac1{z+i}-\frac1{z-i}\right)dz=\frac{\ln(z+i)-\ln(z-i)}{2i}$$
Thus, $$\int\frac{dz}{1+z^2}= \frac{\ln(z+i)-\ln(z-i)}{2i} \bigg\vert^{z=1}_{z=0}$$
Considering the multi-value-ness of $\ln$ you would obtain the desired result.
In essence, $$\begin{align} \frac{\ln(z+i)-\ln(z-i)}{2i}\bigg\vert^{z=1}_{z=0} &=\frac{\ln(1+i)-\ln(1-i)+\ln(i)-\ln(-i)}{2i}\\ &=\frac{\ln(\sqrt2e^{i(\pi/4+2m\pi)})-\ln(\sqrt2e^{i(-\pi/4+2n\pi)})}{2i}\\ &~~~~+\frac{\ln(e^{i(\pi/2+2p\pi)})-\ln(e^{i(-\pi/2+2q\pi)})}{2i}\\ &=i\frac{\pi/4+\pi/4+\pi/2+\pi/2+2N\pi}{2i}\\ &=\frac{\pi}4+N’\pi\\ \end{align} $$ where $N’$ is an arbitrary integer.