It takes place in the settings app of your iPhone. The option to sign out of remove mail used to be under accounts and passwords, but with iOS 13 or later, you can find it under the mail settings.