The mechanism:
Reduction of the alkyne by sodium results in breakage of the C-C double bond and formation of an anion adjacent to a radical. The radical that is formed can interconvert between its cis and trans form, but the trans is generally more stable due to steric factors. The anion is then protonated by NH3 (the only acid present in solution) to give the vinyl radical, which is then reduced by a second equivalent of Na to give a second anion. This is then (you guessed it) then converted to the alkene by protonation with a second equivalent of NH3. So the net process gives a trans-alkene and two equivalents of NaNH2.
How it works: Reduction of alkynes
Sodium metal has an extremely low ionization energy and will readily give up its electron.