In a closed system, no external forces act. In a closed system, the total momentum before an event is equal to the total momentum after the event. This is called conservation of momentum. Momentum is not lost in a collision. It is shared out between the objects, so we say that momentum is conserved.
Momentum has direction, so choose one direction as positive. Momentum in the opposite direction is then negative. Two trolleys at rest, pushed apart by a spring, have a total momentum of zero before. Afterwards the momenta must still add up to zero, so the trolleys have equal momentum in opposite directions. For example, a 1 kg trolley moving right at 2 m/s has momentum +2 kg m/s, and a 2 kg trolley moving left at 1 m/s has momentum -2 kg m/s. The total is zero.
Calculation: a 2 kg trolley moving at 3 m/s hits a stationary 1 kg trolley and they stick together. Total momentum before = 2 × 3 = 6 kg m/s. After the collision the combined mass is 3 kg, so 3 × v = 6 and v = 2 m/s.
Collisions between trolleys can be investigated in the lab. Light gates, data loggers or ticker timers measure the velocities before and after.