Suppose the electric field $\vec{E}$ in which charge $q_{0}$ moves is caused by several point charges $q_{1}$, $q_{2}$, $q_{3}$, … at distances $r_{1}$, $r_{2}$, $r_{3}$, … from $q_{0}$.

The potential energy associated with the test charge $q_{0}$ at point a is the algebraic sum:

$$\begin{aligned} U_{a} &= \frac{q_{0}}{4 \pi \epsilon_{0}} \left( \frac{q_{1}}{r_{1}} + \frac{q_{2}}{r_{2}} + \frac{q_{3}}{r_{3}} + … \right) \\ &= \frac{q_{0}}{4 \pi \epsilon_{0}} \sum\limits_{i} \frac{q_{i}}{r_{i}} \end{aligned}$$

Note that the force experienced by the test charge is:

$$\begin{aligned} \vec{F} &= \sum\limits_{i} \vec{F}_{i} \\ &= \frac{q_{0}}{4 \pi \epsilon_{0}} \sum\limits_{i} \frac{q_{i}}{r_{i}^{2}} \hat{r}_{i} \end{aligned}$$

If we start with charges $q_{0}$, $q_{1}$, $q_{2}$, $q_{3}$, … all separated from each other by infinite distances and then bring them together so that the distancce between $q_{i}$ and $q_{j}$ is $r_{ij}$, the total potential energy is:

$$\begin{aligned} U &= \frac{q_{0} q_{1}}{4 \pi \epsilon_{0} r_{01}} + \frac{q_{0} q_{2}}{4 \pi \epsilon_{0} r_{02}} + \frac{q_{1} q_{2}}{4 \pi \epsilon_{0} r_{12}} + … \\ &= \frac{1}{4 \pi \epsilon_{0}} \sum\limits_{i < j} \frac{q_{i} q_{j}}{r_{ij}} \end{aligned}$$