First of all, you need to be familiar with models for magnetic exchange. Two important examples are Heisenberg and Ising:
Depending on the system you are studying, you will be using one of these. Typically, for very anisotropic spins with a very well defined axis for the spin projection, you should use the Ising model, which is simpler. On the other hand, more isotropic spins will require a Heisenberg model.
These models will give you the energy difference per ion pair between the parallel and antiparallel configuration. Your calculation, for extended solids, will typically give you energies for different spin alignings in a fragment of the crystal containing several magnetic ions. The energies of the fragments will therefore differ in a larger value than the magnetic exchange parameter; you need to adjust the energies accordingly. This can be as simple as a linear factor.
In the example you provide, the set of equations arises because there are different (super)exchange interaction pathways, that present different strenghts. These need to be estimated independently, and this is why you need more than two energies to extract the needed information univocally.