$\lim_{R\to \infty}\int_{C_R}\frac{2018z^{2018}+2017z^{2017}}{z^{2018}+z^{2017}+1}dz$ Evaluate $$\lim_{R\to \infty}\int_{C_R}\frac{2018z^{2018}+2017z^{2017}}{z^{2018}+z^{2017}+1}dz$$
where $C_R:=\{z\in \mathbb{C}:|z|=R\}$. This curve is positively oriented and $R>0$.
Let $$g(z)=2018z^{2018}+2017z^{2017}$$ and $$h(z)=z^{2018}+z^{2017}+1$$ so that $$f(z)=\frac{g(z)}{h(z)}$$
Note that $h(z)$ has $2018$ roots in complex plane: $h(z_n)=0,\ n=1,...,2018.$
If $R$ is large enough, every pole of $f(z)$, that is, every root of $h(z)$ is inside $C_R$. 
If the poles are all simple, i.e. multiplicities of poles are all $1$, we have the following by L'Hopital's rule: $$Res(f,z_n)=\lim_{z\to z_n}(z-z_n)f(z)=\lim_{z\to z_n}\frac{zg(z)-z_ng(z)}{h(z)}=\lim_{z\to z_n}\frac{g(z)+zg'(z)-z_ng'(z)}{h'(z)}=\frac{g(z_n)}{h'(z_n)}=z_n$$
Hence from the Residue theorem, we have $$\int f(z)dz=2\pi i\sum_{n=1}^{2018}z_n=-2\pi i$$
The last equality follows from the root-coefficient relationship of the polynomial $h$.
I feel like I was on the right track, except that I have no idea on how to show the multiplicities of poles are all $1$.
And I'm not sure if the answer is correct. 
 A: Here's how you can show that all of the poles have multiplicity one. 

$\textbf{Lemma}$. For a polynomial $p(z)$ and a root $z_0$: $z_0$ is a repeated root $\iff$ $z_0$ is a root of $p'(z)$. 
Proof: Let $p(z) = (z-z_0)^mq(z)$ where $q$ is another polynomial where $q(z_0)$ and $m > 1$. Then
$$p'(z) = m(z-z_0)^{m-1}q(z) + (z-z_0)^mq'(z) \implies p'(z) = 0$$
and for the backwards direction suppose $m=1$ (the contrapositive of the converse) then
$$p'(z) = q(z) + (z-z_0)q'(z) \implies p'(z_0) = q(z_0) \neq 0$$
hence a contradiction.

With that out of the way consider
$$p(z) = z^{2018} + z^{2017} + 1 \implies p'(z) = z^{2017}(2018z+2017)$$
The only roots of $p'$ are $0$ and $-\frac{2017}{2018}$, neither of which are roots of $p$, thus all of the roots of $p$ have multiplicity one.
A: 1. Any pole of order $\geq 2$ must solve the following system of equations:
$$ h(z) = z^{2018} + z^{2017} + 1 = 0,  \qquad h'(z) = 2018 z^{2017} + 2017 z^{2016} = 0 $$
It is easy to check that this system has no solution, and therefore, $g(z)/h(z)$ has only simple poles.
2. The integrand takes the form $zh'(z)/h(z)$. If $h$ is a polynomial and has a zero of multiplicity $m$ at $a$, then we may write $h(z) = q(z)(z - a)^m$ for some polynomial $q$ with $q(a) \neq 0$, and so, 
\begin{align*}
\frac{zh'(z)}{h(z)}
&= \frac{z(q'(z)(z-a)^m + mq(z)(z-a)^{m-1})}{q(z)(z-a)^m} \\
&= \frac{z(q'(z)(z-a) + mq(z))}{q(z)(z-a)}
\end{align*}
This tells that
$$ \underset{z=a}{\mathrm{Res}}\, \frac{zh'(z)}{h(z)} = m a, $$
and so,
$$ \lim_{R\to\infty} \int_{|z|=R} \frac{zh'(z)}{h(z)} \, \mathrm{d}z = 2\pi i \sum_{k} z_k $$
where $z_k$'s are zeros of $h$ counted with multiplicity.
3. Here is another way of deriving the above result, using the idea of inversion:
Write $w = \frac{1}{z}$. Then the circle $|z| = R$ oriented counter-clockwise transforms to the circle $|w| = 1/R$ oriented clockwise, and so,
$$ I_R := \int_{|z|=R} \frac{zh'(z)}{h(z)} \, \mathrm{d}z
= \int_{|w|=1/R} \frac{(1/w)h'(1/w)}{h(1/w)} \, \frac{\mathrm{d}w}{w^2} $$
For further simplification, we define
$$\tilde{h}(w) = w^{n} h(1/w) = a_n + a_{n-1}w + \dots + a_0 w^n,$$
where $n$ is the degree of $h$ and $h(z) = a_0 + a_1 z + \dots + a_n z^n$. Then $\tilde{h}$ is also a polynomial and
$$ \tilde{h}'(w) = n w^{n - 1} h(1/w) - w^{n-2}h'(1/w) . $$
From this, we get
\begin{align*}
I_R
&= \int_{|w|=1/R} \frac{h'(1/w)}{w^3 h(1/w)} \, \mathrm{d}w \\
&= \int_{|w|=1/R} \biggl( \frac{n}{w^2} - \frac{\tilde{h}'(w)}{w \tilde{h}(w)} \biggr) \, \mathrm{d}w
\end{align*}
Since we know that $\tilde{h}(0) = a_n \neq 0$, Cauchy Integration Formula tells that
$$ \lim_{R\to\infty} I_R = - 2\pi i \frac{\tilde{h}'(0)}{\tilde{h}(0)} = -2\pi i \frac{a_{n-1}}{a_n}. $$
A: You can also use the residue at infinity to calculate the integral for $R$ large enough:
$$\int_{C_R}f(z)dz = - 2\pi i Res_{z=\infty}f(z) =2\pi i Res_{z=0}\left(\frac 1{z^2}f\left(\frac 1z\right)\right)$$
$$= 2\pi i Res_{z=0}\left(\frac 1{z^2}\frac{2018 + 2017z}{1+z+z^{2018}}\right)=2\pi i(2017-2018) = -2\pi i$$
