On a remote server I need to type exit to leave a certain mode but unfortunately the exit is picked up by ssh and treated as an instruction to end the shh session.
The instructions that you see to exit from VMWare Tech Support Mode is probably meant for console access. For example Tech Support Mode for Emergency Support:
In other words, your SSH / shell session is the Tech Support Mode itself. Once you have exited from the Tech Support Mode, your SSH / shell session will terminate as well
I'm not sure how you could do it efficiently, but you could use
Or if you're already in the mode, SSH in again.
Check and see if the "mode" you're in has any other ways to exit, eg; shortcut, another command etcetera.