In the Bethe approximation, one considers explicitly a small cluster consisting of one "central" spin and its nearest neighbours. The spins further out from the central one are replaced by their mean-field values $m$. This can be taken to be a constant, but as-yet-undetermined value. Now, the energy of the small cluster, in its surroundings of fixed mean-field spins, is written down, and from this the statistical mechanics of the small cluster of explicit spins can be worked out in detail. The value of $m$ is determined self consistently. I won't go through that part in detail: from your question, it looks like you are just troubled by this first step.
Your second equation gives the energy for this small cluster, for a very simple example: the one dimensional Ising model. The central spin is labelled $0$, and its neighbours labelled $1$ and $2$. The interactions $J$ between $0$-$1$ and $0$-$2$ are given explicitly, as are the $J$ interactions between the neighbours $1$ & $2$ and the mean field spins $m$ which are outside them. Also the external field terms $h$, acting on all three explicit spins, appear. That's all you need to compute the partition function for the three spin cluster, surrounded by the mean field.
So the answer to your question is that the pair sum is not performed in entirety: just the part corresponding to the small cluster embedded in a surrounding mean field. Or, if you prefer, all the terms in the sum over neighbouring pairs are included, but the spin values for those spins not included explicitly in the cluster are set equal to $m$, and this gives a large number of constant terms in the sum, which can be dropped as they will not affect the final result. That's the nature of the approximation.