Unless someone is unethical there is not a proper situation where someone is surprised to be fired. Leading up to being fired the individual should be informed of their deficiencies, coached, and remedial goals set.
A good manager cares about the success of their people and if people are being surprise fired then that speaks to the leadership deficiencies in management.
Organizations who surprise fire people will suffer from morale and retention issues because employees do not feel two-way loyalty.
Performers the company wishes to retain will feel uneasy and always watching for secondary options should they encounter a firing ambush. It’s always better to leave on one’s own timing, than the timing of others.
Furthermore, companies who have a habit of suddenly terminating employees will experience whatever negative perceptions the employee may have percolating into the broader industry. Whether there is truth to a former employee’s complaints or not, it doesn’t matter. Guard your reputation by striving to part well with your fellow humans.