Consider a polynomial $f(z)=c\prod_m(z-\lambda_m)\in\mathbb{C}[z]$. I am mostly interested in the case where this actually lies in $\mathbb{R}[z]$, but that is not essential. I wanted to find a nice formula for a smooth function on $\mathbb{R}$, depending continuously on the coefficients of $f(z)$, which approximates a sum of $\delta$ functions concentrated at the real roots of $f$. A natural choice is $$ \phi_\epsilon(f)(t) = \sum_m\exp(-\pi|t-\lambda_m|^2/\epsilon^2). $$ I found that $$ \sum_m\exp(-\pi|\lambda_m|^2) = \iint_{\mathbb{C}}k(|z|)\log|f(z)|\,|dz|^2, $$ where $$ k(r) = 4(\pi r^2-1)e^{-\pi r^2} = -2r^{-1}\frac{d}{dr}(r^2 e^{-\pi r^2}). $$ The more general formula $$ \phi_\epsilon(f)(t) = \epsilon^{-2}\iint_{\mathbb{C}} k(|z-t|/\epsilon)\log|f(z)|\,|dz|^2 $$ can easily be deduced from this. I have a proof of all this, by a longish chain of fairly standard manipulations, but it is probably more complicated than necessary.
I suspect that this identity must be known, but I don't believe I have ever seen it before. Can anyone point me to a reference?