The most common reason for losing synchronization in my experience is that the right-side motor shifts while I am messing with the filament (changing filament, adjusting the extruder, etc.).
The rule I have developed to avoid problems is this:
ALWAYS HAVE THE STEPPER MOTORS ENABLED WHEN TOUCHING THE EXTRUDER
With the steppers enabled, I have never had the Z-axis motor spin while adjusting the extruder.