When you leave the team as a leader, the leadership position will be given to another player on the team randomly.
If you rejoin the same team, you will not retake the leadership position.
Also, if you leave the team as a leader when there are no other teammates, the team will be deleted when you leave. If you try to search and rejoin your team, you will not be able to find it for this reason.
After 21 days of inactivity, the team leader will lose their leadership position.