I used to have a vague feeling that the residue theorem is a close analogy to 2D electrostatics in which the residues themselves play a role of point charges. However, the equations don't seem to add up. If we start from 2D electrostatics given by $$\frac{\partial E\_x}{\partial x} + \frac{\partial E\_y}{\partial y} = \frac{\rho}{\epsilon\_0},$$ where the charge density $\rho = \sum\_i q\_i \delta(\vec{r}-\vec{r}\_i)$ consists of point charges $q\_i$ located at positions $\vec{r}\_i$, and integrate over the area bounded by some curve $\mathcal{C}$, we find (using Green's theorem) $$\int\_\mathcal{C} (E\_x\, dy - E\_y\, dx) = \frac{1}{\epsilon\_0} \sum\_i q\_i.$$ Now, I would like to interpret the RHS as a sum of residua $2\pi i\sum\_i \text{Res}\, f(z\_i)$ of some analytic function $f(z\_i)$ so that I would have the correspondence $$q\_i = 2\pi i\epsilon\_0 \text{Res}\, f(z\_i).$$ For this to hold, the LHS would have to satisfy $$\int\_\mathcal{C} (E\_x\, dy - E\_y\, dx) = \int\_\mathcal{C} f(z)\, dz,$$ however, it is painfully obvious that the differential form $$E\_x\, dy - E\_y\, dx = -\frac{1}{2}(E\_y+iE\_x)dz + \frac{1}{2}(-E\_y + iE\_x)dz^\*$$ can never be brought to the form $f(z)dz$ for an analytic $f(z)$.

So, it would appear that there really isn't any direct analogy between 2D Gauss law and the residue theorem? Or am I missing something?