Before the tournament starts
On the website: after you join, the button on the tournament page changes to Tournament starts soon…. Click the arrow next to it, choose Leave and confirm with Yes. You can join again at any time until the tournament starts.
In the app: open the tournament from the Tournaments tab, tap ⋮ next to the timer and tap Leave. The app doesn't ask you to confirm, so you leave right away.
During the tournament
You can also leave a tournament that has already started: choose Leave in the same menu on the tournament page. Keep in mind:
you can't join the same tournament again;
you stay in the standings with the points you've already won, marked as having left;
games you've already played still count for your rating.
Just need a break?
In an Arena, you don't have to leave. Press Hold at the top of the tournament page, and you won't get new games. Press Resume when you're ready to play again.
What if I miss my games?
In a Swiss tournament, games start automatically. If you miss two games in a row, you're removed from the tournament.
Learn more about Arena and Swiss in What tournament systems do you have on World Chess?