You can leave your alliance by tapping “Alliance” in the bottom right menu, opening the “MANAGE” tab on the left, and tapping “Leave Alliance” on the right side.

Note that starting from S1, there is a 24-hour cooldown for joining a new alliance after you leave your current one. Also, you can’t leave an alliance during the last Alliance Duel day.
On Sundays, the cooldown is much shorter (30 minutes, if I remember right). After S5, in Homeworld, the cooldown is also 30 minutes.
Next Question: How to reset a hero?