Contour integral of Singularities Consider a finite set of distinct real numbers $E_1,E_2,...,E_n$. Let $I$ denote a subset of $1,...,n$ and let $\Gamma$ denote a contour in $\mathbb{C}$ which contains out $E_i,i\in I$ and none of the remaining real numbers. Is there a nice method to compute the following contour integral
$$
\oint_\Gamma \prod_{j\in J}\frac{1}{z-E_j}dz
$$
Where $J$ is a sequence of indices, rahter than a subset, so that $E_j$ may repeat, e.g.,
$$
\oint_\Gamma \frac{1}{z-E_1} \frac{1}{z-E_1}dz
$$
Now there are many particular examples which are easy to solve. For example, if the indices $J$ are all distinct and form a subset of $I$, it's clear that the integral is zero. An other example would be if $I$ has a single index, then it's clear that the integral is nonzero only if one of the $j\in I$ and no other.
So to me, this seems that there must be a nice general formula for such an integral considering the simplicity for special cases.
 A: I assume you want hints  for  dealing with the case of repeated linear factors in the denominator.
Notation.
Index the pole points  $p_k$ inside $\Gamma $  by $k\in K$ and let  the order of $p_k$ be $m_k$.  The function $\frac{1}{S(z)}= \Pi_k \frac{1} {(z- p_k)^{m_k}}$  has its singularities inside $\Gamma$.
Index the pole points $p_j$ outside $\Gamma$  by $j\in J$ and let the  order of $p_j$ be $n_j$. The function $R(z)=\Pi_j \frac{1} {(z- p_j)^{n_j}}$ has no singularities inside the curve.

*

*Consider first the special case where all poles are simple, of order  $1$.

In this case  the integral $I= \int_{\Gamma} \frac{ R(z)}{S(z)} dz $  can be evaluated by the Residue Theorem
Each residue at $p_k$ is of the form $2\pi i \frac{R(p_k)}{S'(p_k)}$.
Thus $I= 2\pi i \sum_k  \frac{ R(p_k)}{S'(p_k)}$.
Note that the answer is a rational algebraic expression in the various poles $p_k$ and $p_j$.


*Next, to solve the problem when the orders of the poles  sometimes exceed 1, differentiate the expression $I$ obtained above with respect to the various independent parameters $p_k$ and $p_j$.  (Apply the technique of differentiation across the integral sign).

P.S. Note that some factorials will arise as pesky numerical factors.
