[Though initially the question may seem to belong to stack exchange chemistry but I believe that I would get a better physical explanation over here. ]
Currently I was reading about electron affinity of elements and found that for most of the release energy when an electron is added to them , this made me question why this is so? So I searched and found an answer on chemistry SE. But in the answer it states
When a system goes from a higher energy state to a lower energy state, it loses energy.
But considering the electron and nucleus as a system shouldn't the energy remain constant if the net external forces acting on the system is zero.But if I'm going wrong somewhere can you explain why and where I'm going wrong? Also please explain if you know as to what is really happening and why the energy is released.