Contour integral of $z^k/p(z)$ for $p(z)=\prod_{j=0}^m(z-\lambda_j)$ As stated in the title, let $m\geq k$ be natural numbers ($k$ possibly zero) and let $p(z)=\prod_{j=0}^m(z-\lambda_j)$ where $\lambda_j\in\mathbb R$ for all $j$. We have by the residue theorem that
\begin{align}
&\frac{1}{2\pi i}\lim_{R\rightarrow\infty}\int_{\lvert z\rvert=R}\frac{z^k}{p(z)}\mathrm d z=\sum_{j=0}^m\mathrm{Res}\left(\frac{z^k}{p(z)};\lambda_j\right)\\&=\sum_{j=0}^m \lambda_j^k\prod_{l\neq j}(\lambda_j-\lambda_l)^{-1}.
\end{align}
Now the thing claimed (which I am not able to prove) is that 
\begin{align}
\frac{1}{2\pi i}\lim_{R\rightarrow\infty}\int_{\lvert z\rvert=R}\frac{z^k}{p(z)}\mathrm d z=
\begin{cases}
1&\text{ if }k=m,\\
0&\text{ if }k<m.
\end{cases}
\end{align}
This would then imply that $a_j=\prod_{l\neq j}(\lambda_j-\lambda_l)^{-1}$ is the solution to the system of equations
\begin{align}
\sum_{j=0}^m \lambda_j^k a_j=
\begin{cases}
1&\text{ if }k=m,\\
0&\text{ if }k<m.
\end{cases}
\end{align}
which is needed in order to establish the theorem cited below.
Wagner, Peter, A new constructive proof of the Malgrange-Ehrenpreis theorem, Am. Math. Mon. 116, No. 5, 457-462 (2009). ZBL1229.35007.
 A: $$
\frac{1}{2\pi i}\lim_{R\rightarrow\infty}\int_{\lvert z\rvert=R}\frac{z^k}{p(z)}\mathrm d z= - 2 \pi i \mbox{Res}(f, \infty)$$
where 
$$\mbox{Res}(f, \infty)= - \mbox{Res}(\frac{1}{z^2}f(\frac{1}{z}),0)$$
Now, let $P(z)=z^{m+1}+a_{m}z^{m}+..+a_1z+a_0$ then
$$\frac{1}{z^2}f(\frac{1}{z})=\frac{1}{z^2}\frac{1}{z^k} \frac{z^{m+1}}{1+a_{m}z+...+a_0z^{m+1}}$$
Now, 


*

*if $m \geq k+1$ the function $\frac{1}{z^2}f(\frac{1}{z})$ is Analytic at $z=0$ and hence 
$$\mbox{Res}(f, \infty)= - \mbox{Res}(\frac{1}{z^2}f(\frac{1}{z}),0)$$

*If $m=k$ then $\frac{1}{z^2}f(\frac{1}{z})=\frac{1}{z} \frac{1}{1+a_{m-1}z+...+a_0z^m}$ and since $ \frac{1}{1+a_{m-1}z+...+a_0z^m}$ is Analitic at $z=0$ we have 
$$\mbox{Res}(f, \infty)= - \mbox{Res}(\frac{1}{z^2}f(\frac{1}{z}),0)=1$$
P.S. The following Lemma is an easy exercise, and I find it very helpful in many situations, but I missed originally that your product started at 0 and not 1 :)
This Lemma takes immediatelly care of all but 1 cases in your problem.
Lemma: If $\deg(Q) \geq \deg(P)+2$ then 
$$\lim_{R \to \infty} \int_{|z|=R}\frac{P(z)}{Q(z)} dz =0$$
This can be proven as above by showing that the residue at infinity is zero or by observing that for $R$ large enough you have
$$\left|  \int_{|z|=R}\frac{a_kz^k+...+a_0}{b_nz^n+...+b_0} dz \right| \leq 2 \pi r \frac{|a_k|R^k+...+|a_0|}{|b_n|R^n-|b_{n-1}|R^{n-1}-...-|b_0|} \to 0$$
if $k+1<n$.
A: The solution is just a simple application of the l'Hospital rule.
\begin{align}
&\lim_{R\rightarrow\infty}\int_{\lvert z\rvert=R}\frac{z^k}{p(z)}\mathrm d z=\lim_{R\rightarrow\infty}\int_0^{2\pi}\frac{iR^{k+1}\mathrm e^{i(k+1)t}}{p(R\mathrm e^{it})}\mathrm d t\\
&=\int_0^{2\pi}\lim_{R\rightarrow\infty}\frac{iR^{k+1}\mathrm e^{i(k+1)t}}{p(R\mathrm e^{it})}\mathrm d t=i\int_0^{2\pi}\lim_{R\rightarrow\infty}\frac{(k+1)! \,\mathrm e^{i(k+1)t}}{p^{(k+1)}(R\mathrm e^{it})\,\mathrm e^{i(k+1)t}}\mathrm d t\\
&=i\int_0^{2\pi}\lim_{R\rightarrow\infty}\frac{(k+1)!}{p^{(k+1)}(R\mathrm e^{it})}\mathrm d t
\end{align}
where the third equality comes from using l'Hospital rule $(k+1)$ times. 
Now if $k=m$ then because $p$ is of order $m+1$ and its leading coefficient is 1, we get $p^{(k+1)}(z)=(k+1)!$ and the above expression equals to $2\pi i$. On the other hand, if $k<m$, then $p^{(k+1)}(z)$ is a nonconstant polynomial and thus
$$
\lim_{R\rightarrow\infty}\frac {(k+1)!}{p^{(k+1)}(R\mathrm e^{it})}=0,
$$
proving the desired equality.
