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