Dynamics of condensation in zero-range processes