Can anyone show me why this equality below holds? I understand the matrix form of Kronecker delta is an identity matrix, but why this "coming from nowhere" delta function $\delta_{i,j}$ can have the exact same index $(i, j)$ as the previous terms?
$$\sum_j p_ j|\psi_j\rangle\!\langle\psi_j|\rho^{-1}|\psi_i\rangle= \sum_j p_j|\psi_j\rangle\!\langle\psi_j|\rho^{-1}|\psi_i\rangle\delta_{i,j},$$
where $\rho$ is a diagonal density matrix.