Great question! This is handled at the DNS level. You set your primary A record to the server hosting the website (as well as a www record, if you like). Then you have MX records which are separate records. Those are the ones that you point to your mail server.
To give you an idea of what this looks like in our DNS panel:
In this example 127.0.0.1 would represent the web server address while 127.0.0.2 would represent the mail server address. I hope that helps!
If I can be of any further assistance, please be sure to let me know.
Platform Support Specialist