Equilibrium of charges and differential equations solved by polynomials