How to compute this winding number integral? I am trying to compute the following integral:
\begin{equation}
I =\frac{1}{2\pi}\int_{-\pi}^{\pi}\frac{ae^{ik}-be^{-ik}}{ae^{ik}+be^{-ik}}dk.
\end{equation}
I know that the answer should be that $I = 1$ if $|a|>|b|$ and $I = -1$ if $|a|<|b|$ (since it's a winding number of a curve around the origin I'm trying to find), but I cannot seem to get this. My attempt:
\begin{equation}
I =\frac{1}{2\pi}\int_{-\pi}^{\pi}\frac{ae^{ik}-be^{-ik}}{ae^{ik}+be^{-ik}}dk = \frac{1}{2\pi}\int_{-\pi}^{\pi}\left[1-\frac{2be^{-ik}}{ae^{ik}+be^{-ik}}\right]dk = 1-\frac{1}{\pi}\int_{-\pi}^{\pi}\frac{1}{\frac{a}{b}e^{2ik}+1}dk.
\end{equation}
But how do I continue from here?
 A: The integral is equal to
$$
 \frac{1}{2 \pi i} \int_{\gamma} \frac{az-b/z}{az+b/z} \frac{dz}{z}
= \frac{1}{2 \pi i} \int_{\gamma} \frac{az^2-b}{(az^2+b)z} \, dz \, 
$$
with $\gamma(t) = e^{it}$, $-\pi \le t \le \pi$.
Consider the case $a, b \ne 0$ first. Then we can choose a number $c\ne 0$ such that $c^2=-b/a$, so that
$$
\frac{az^2-b}{(az^2+b)z} = \frac{z^2+c^2}{(z^2-c^2)z} = \frac{1}{z-c} + \frac{1}{z+c} - \frac 1z \, .
$$
It follows that the integral can be computed as the sum of three winding numbers:
$$
 I = \operatorname{Ind}_\gamma(c) + \operatorname{Ind}_\gamma(-c)  - \operatorname{Ind}_\gamma(0) 
= \begin{cases}
 1+1-1 = 1 &\text{if }|c|<1 \, ,\\
 0+0-1 = -1 &\text{if }|c|>1 \, .
\end{cases}
$$
I'll leave the cases $a=0$ and $b=0$ to you.

One can also use the curve $\Gamma(t) = e^{2it}$, $-\pi \le t \le \pi$. Note that $\Gamma$ surrounds the unit disk twice. With $d=-b/a$ this gives
$$
 I = \frac{1}{4\pi i} \int_\Gamma \frac{z+d}{(z-d)z} \, dz
= \frac{1}{4\pi i}\int_\Gamma \left( \frac{2}{z-d}-\frac 1z\right) \\
= \operatorname{Ind}_\Gamma(d) - \frac 12 \operatorname{Ind}_\Gamma(0)= \begin{cases}
 2-1 = 1 &\text{if }|d|<1 \, ,\\
 0-1 = -1 &\text{if }|d|>1 \, .
\end{cases}
$$
A: Let$$R(x,y)=\frac{a x-b x+i a y+i b y}{a x+b x+i a y-i b y};$$then$$R\bigl(\cos(k),\sin(k)\bigr)=\frac{ae^{ik}-be^{-ik}}{ae^{ik}+be^{-ik}}.$$Now, let$$f(z)=\frac1zR\left(\frac{z+z^{-1}}2,\frac{z-z^{-1}}{2i}\right)=\frac{az^2-b}{az^3+bz}.$$Then\begin{align}\frac1{2\pi}\int_{-\pi}^\pi\frac{ae^{ik}-be^{-ik}}{ae^{ik}+be^{-ik}}\,\mathrm dk&=\frac1{2\pi}\oint_{|z|=1}f(z)\,\mathrm dz\\&=\frac1{2\pi i}\oint_{|z|=1}\frac{az^2-b}{az^3+bz}\,\mathrm dz,\end{align}which, by the residue theorem, is the sum of the residues of $f$ at those points $z_0$ such that $|z_0|<1$. One of those points is $0$, and $\operatorname{res}_{z=0}\left(\frac{az^2-b}{az^3+bz}\right)=\frac{-b}b=-1$. Now, if $|a|<|b|$, then there is no other point $z_0$ such that $|z_0|<1$ at which $f$ has a singularity. So, in this case your integral is equal to $-1$. If $|a|>|b|$, then there are two other such points: the square roots of $-\frac ba$. And the residue of $\frac{az^2-b}{az^3+bz}$ at those two points is $1$. Therefore, in that case your integral is equal to $1(=-1+1+1)$.
