You can leave a workspace that you’re a member of from the Workspace Members page. Click on your name, navigate to the top of the list and click the “Leave” button.
☝️ Restricted members are unable to access the Workspace Members page. In this case, you can leave projects to which you’re invited individually, but to leave the workspace, you'll need to contact the workspace Owner or Admins. They can remove you from the workspace as explained here: Removing workspace members.