The ancient Athenians wanted to avoid tyranny, or one-man rule, at all costs, and thus they invented or adopted the ideas of rotation, accountability, and the use of the lottery. Rotation means term limits. No one could hold the same office for more than a year, except for the members of the Areopagus court (their version of the Supreme Court), who held their posts for life. Everyone else rotated out. People could serve twice in a lifetime.
Another safeguard against tyranny was for committees to make all decisions rather than letting one man, unsupervised, gain too much prestige. All city jobs, paid or not, from army general to sewer commissioner, were staffed by ten men, one from each tribe. Ten people had to make every decision. It boosted accountability, but it's a wonder anything got done.
These committees were selected by lottery, one man from each tribe for a board of ten. Only generals and treasurers were elected by public vote. Generals, when you think about it, needed skills and experience, so the lottery was not ideal for that. Pericles was one of ten elected generals, reelected 15 years straight, but one year he was voted out, then reelected the next year. Treasurers needed some math skills, so they were elected exclusively from the two wealthiest economic classes.
Use of the lottery to select people to serve in civic offices and on juries became standard practice in Achens. To conduct the lotteries, the Athenians used a clever machine called a Kleroterion, an upright marble jab with ten columns of slots. On selection day, anyone who wanted to serve in an office would put his identification card in a slot under the name of his tribe, thus creating horizontal rows of cards, one from each tribe. When the grid was full, white and black balls were fed into a cone.
The balls randomly dropped down into a tube next to the slots. As each ball dropped, a row of people's identification cards would be rejected or accepted, depending on whether the ball chat came out of the tube was black (rejected) or white (accepted). If a row was selected, all ten men would be that year's board of supervisors, or sanitary commission, or archons (like mayors), or whatever officers were being chosen at that time. Think of how radical this is--the Athenians trusted each other enough to let the machine select their magistrates.
These machines were also used to select jurors, in which case they didn't select just ten men, but 50 to 1,500, depending on the case.
Selection by lottery was interpreted as being chosen by the gods, whose will it was to select or reject each row. Losers accepted the result with grace, knowing it was divine will.
Every so often, the Athenian people expelled powerful individuals who seemed to pose a threat to democracy. They sent them away for ten years, but their families could stay behind and they didn't lose their property. When the exiles returned, they were out of the loop. Their social networks were weaker and older, and most of the pressing political issues from their day had long been resolved.
How did it work? Over the course of a specific three-week period, Athenians would consider who, if anyone, ought to be ostracized. On decision day, citizens brought to the city center broken potsherds (the Greek word is ostracon). At home or on the way, they scratched a name onto the piece of clay. When they got downtown, they would drop the piece into a box. If any one person's name appeared on 6,000 or more potsherds, he would be ostracized. Many excavated ostraca have the names of the most famous people of Athenian history, although not all were actually ostracized because some fell short of the required 6,000 votes.