For EAP/FSD : twice already I was surprised by the car suddenly aborting a lane change mid-way and suddenly swerving back to its original position. What is usually the trigger for that and how to prevent it. Was quite dangerous and caused some passenger complaints!
A number of potential reasons, some already covered here. But it can also be caused by 'user error' which is caused by poor implementation.
An auto lane change must complete within a set period of time (can't remember exact duration, but not very long). By complete, the car needs to have passed/seen the lines of the lane that you are changing into - again, cannot remember the exact rule but the gist of it (example is overtaking, so changing into right lane, but its the opposite when changing to left lane) is that if the car has not seen that the passenger side of the car has passed the white line by the time that the manoeuvrer 'times out', it will abort the lane change in, as you have discovered, an alarming way, by suddenly moving back from whence it came - even more worrying when some impatient twat has started to fill that space.
The user error is that when signalling for the lane change, the car is expecting to feel you holding the steering wheel. There is a short grace period, but if it is left too long, part of the poor implementation is that the car will start the lane change without having enough time to complete, hence suddenly pulling back into lane. So when prompted to hold the wheel, don't leave it too long to satisfy the nag. Even better, don't trigger the nag in the first place by ensuring that you are satisfying the torque requirements right from the outset, which will give a seamless lane change.
Gained from experience of being in that position one too many times including having some twat try to overtake me as I was pulling back in from an overtake, car lane change aborts, and car swerve right back in front of them... Lesson learned not to use auto lane change if cars behind me.