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.
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.