If you have recognised the signs of the times early on, you will hopefully be mentally prepared for the situation and manage to remain calm and act in a considered manner overall. After the dismissal or an intention to separate that has been presented to you, it is important to first process the situation, but then to look ahead as quickly as possible and act in a targeted manner.
One of your first steps should be to work with a trusted employment lawyer to talk through the legal situation and take the necessary steps to negotiate favorable separation terms with your employer. At the same time, however, it is necessary to look ahead in order to move on with your career quickly. Counselling called new or outplacement usually helps to significantly shorten the time until you find a new job and start a new activity.
In most cases, the boss will arrange an appointment with you in his office at short notice via his secretary. How the termination interview goes depends a lot on the company culture and your boss's personality. Unless you are in a "hire and fire" company, your boss may have the most difficulty with the termination interview. He has to deliver what he sees as the worst of all possible messages to you and will squirm accordingly in the conversation. Often he will not even mention the word "dismissal" himself, and under certain circumstances you may not really know where you stand after the interview.
In a well-prepared dismissal, the HR manager will be sitting next to your boss and will already have the written notice of termination or - what happens more often - a severance or settlement offer with him. Whatever happens in this conversation, you remain as calm as possible and do not sign a severance agreement or make any threats.
You simply ask for time to think it over. If you don't know the reasons for termination yet, you can ask about them - this may help you process the situation better later. All in all, you should assume that after an official conversation in which you are advised to part ways, there will be no staying with the company in the long run. This is because such a conversation usually shatters the existing relationship of trust.