This process generally start during notice period. Companies have around 30 days of notice for people planning to leave so that they can start the process of separation.
During this time, the emphasis is on completing the existing work and delegating responsibilities to the teammates. The tasks are:
Shift the priority to backlogs owned (by you) from taking new work
If you talk to external clients, try to refer them on a case-by-case basis to the appropriate team members.
Strive complete the tasks a bit over a week earlier. Keep the last week obligations to little over none.
You might be friends with some of your colleagues, discuss how are you going to interact in future - if possible, choose a time period like once in month if the they are very close and the mode of communication (instant, email, or phone call). Prefer email.
Keep the leaving process less dramatic. More like, if you rejoin after a while it should not feel awkward.
Slowly increase time for reflection. Write down the process that you adopted while doing tasks. Keep them as a shared document, and help a teammate how to utilize this document to do work efficiently.
The moment you take a signed document from the company that you are officially relieved, then do not respond to any work related emails from them - instead redirect them without your personal note. Literally, do not care about what happens after you leave because it is illegal to mind the business of an ex-company.
Now, write down the things (technical, managerial, and self) you have learned at this company and move on. Take a little (at least a week) break.