This follows by 2 applications of Green's theorem, and is essentially a classical result in the basic theory of PDEs. Namely that in dimension 2, the solution to the Poisson equation
$$ \Delta u = \psi$$
for $\psi \in C^2_c(\mathbb R^2)$ is
$$ u(x) = \frac1{2\pi}\int_{\mathbb {R}^2} \psi(z)\log|z-x| \, dm(z).$$
Its usually proven by "integration by parts" i.e. Green's theorem twice, each time transferring one gradient in $\Delta = \nabla\cdot\nabla$ to the logarithm, but you have to either develop some distribution theory or be careful with the behavior at 0 by cutting out a small ball around $0$ and then taking a limit.
This is done in Evans around page 20, Green's Function for 2D Poisson Equation, these set of notes, or these other set of notes.
The danger when blindly integrating by parts is that $\Delta \log|z| = 0$ everywhere where this function is defined, but it doesn't integrate the same as the 0 function. As a distribution, its more correct to say that $\frac1{2\pi}\Delta \log|z|$ is the unit Dirac mass at 0.
Now note that we can write starting from the right-hand side,
$$ \text{RHS} = \frac1{2\pi}\int_{\mathbb R^2} \Delta \psi(z) \sum_{j=1}^n \log|z-\lambda_i| dm(z) = \sum_{j=1}^n \Delta u(\lambda_i) = \sum_{j=1}^n \psi(\lambda_i),$$
Which is the left-hand side. The Laplacian $\Delta$ went through the integral onto $\psi$ as a general property of convolutions; the 1D analogue is $(f*g)' = (f')*g = f*(g')$, and the same holds in higher dimensions.