What prompts sodium to give up an electron?
To asses the possibility of a chemical change, we need to look into the spontaneity as given by the thermodynamic Gibbs' Free energy change at constant T and P. For your particular case, the change occurs when an electron accepting ion is present to form the crystalline compound after the electron exchange, in solution where the hydration releases energy or in certain solutions such as ammonia, where solvation of free electrons also take part.   

Case (1). The changes involved are $$\ce{Na_{(s)}-&gt;Na_{(g)}^+ +e^{-}}$$, $$\ce{M_{(g)} +e^{-}-&gt;M^{-}}$$ $$\ce{Na_{(g)}^+ + M_{(g)}^{-}-&gt;NaM_{(s)}}$$ 

Where $M$ is an electronegative atom.The ionization energy ($\Delta H_{I}$) and the sublimation energy ($\Delta H_S$) required in the first transformation need to be compensated for by the electron gain enthalpy($\Delta H_{eg}$) released in the second transformation and the lattice enthalpy($\Delta H_{F}\text{lattice}$) released in the final transformation. If it is compensated, the change will be spontaneous. Moreover, the enthalpy released (negative) must also compensate for the lost entropy since gaseous $M$ is converted to an ordered crystal. $\Delta G=\Delta H-T\Delta S$ tells you the compensation required for $\Delta G$ to be negative.
($|\Delta H_{eg}+\Delta H_F|-|\Delta H_I+\Delta H_S|&gt;|T\Delta S|$) 

Case (2) Elemental sodium in water might lose electrons to the hydrogen evolving hydrogen gas and forming dissolved sodium hydroxide. 
$$\ce{Na_{(s)}-&gt;Na_{(aq)}^+ + e^{-}}$$
$$\ce{H2O +e^{-}-&gt;\frac 12H2 +OH-}$$
here, the relesed hydration energy compensates the required sublimation energy in the first step and the negative electrode potential in the second step. There is net positive entropy change which favours the reaction, making $\Delta G$ negative.  ($|\Delta H_{hyd}(\ce{OH^-,Na^+})|+|T\Delta S|=|\Delta G|$)

Case (3) very similar to case (2) but here the solvation is both of free electrons and that of metal ions by ammonia (liquid). The equations are similar except that now instead of the hydration enthalpy, solvation enthalpy will be released. the entropy change is also positive here, supporting the change.