Mass ejection in neutron star mergers