I've never seen the two-electron density written like that. Here are my thoughts but I can't say for sure.Considering the terms where ##i=j## $$\sum_{i}\delta(\mathbf r-\mathbf r_i)\delta(\mathbf r' - \mathbf r_i)$$We should be able to use the identities ##\delta(x - y) = \delta(y - x)## and ##\int dy \delta(x-y)\delta(y-x') = \delta(x-x')## So we rewrite the above as $$\sum_{i}\delta(\mathbf r-\mathbf r_i)\delta(\mathbf r_i - \mathbf r')$$ and when we are computing the electron density function we will be integrating over ##\mathbf r_i## so the latter identity suggests $$\sum_i\int d\mathbf r_1\dots d\mathbf r_N \delta(\mathbf r - \mathbf r_i)\delta(\mathbf r_i - \mathbf r')|\Psi(\mathbf r_1,\dots, \mathbf r_N)|^2 = N\int d\mathbf r_2\dots d\mathbf r_N \delta(\mathbf r - \mathbf r')|\Psi(\mathbf r,\dots, \mathbf r_N)|^2$$For the last line. I am assuming $$\int dx\int dy \delta(x-y)\delta(y-x')f(y) = \int dx \delta(x-x')f(x)$$