Energy isn't always released when an electron is added to an atom. It depends on the kind of atom you are adding the electron to.
Energy is released if the electronegative atom attains a more stable state by accepting the electron (by say attaining a octet configuration in the valence shell). Stable states have less energy when compared to other states and this difference in energy is released when an atom accepts an electron.
On the other hand, it actually requires energy to add an electron to an electropositive atom which has an extra shell of electrons which makes it unstable. To add another electron we would have to overcome the repulsions due the already present electrons and hence energy would have to be supplied rather than it being released. If by how an electron entere you mean that how does an atom gain or lose electrons,its to complete its octet configuration.For example when Mg reacts with o2 As O has 2 less electrons to reach its octet whilst Mg has 2 extra electrons.Mg gives its electrons to O for both of them to complete their octet.This is known as an Ionic bond.Hope it helps
This answer I got from another website. Which is far better than yours.