The official documentation has some useful details on the Unsubscribe process. Please find the link below :
The contact unsubscribes from a campaign by clicking an unsubscribe
link in an email. This opens a tracking page on the CD role where an
EXM unsubscribe handler does three things:
It creates an interaction with an Unsubscribe page event in the
Session State database.
It stores an Unsubscribe message on the Message Bus.
It redirects the contact to a user-friendly unsubscribe page.
When the contact's session ends, the CD role passes the interaction
with the Unsubscribe page event to the xConnect Collection Search role
that stores it in the xDB Collection database. Sitecore uses this
information for analytics and reporting purposes.
Please check this link - https://doc.sitecore.com/developers/exm/90/email-experience-manager/en/the-unsubscribe-options.html
You can check the Unsubcribe.aspx file as mentioned in the link to see how you can ensure this.
When you use the default email campaign templates in EXM, the email
messages you send contain two links that allow recipients to
unsubscribe from future email campaigns - Unsubscribe & Unsubscribe
The Unsubcribe.aspx and the UnsubscribeFromAll.aspx files do the following:
Use the ExmContext to validate that the request is valid, for example,
that the request has a contact ID and a message ID.
Register the Unsubscribe from email page event