San Francisco could make history by electing its first African-American woman, Asian-American woman or openly gay man for mayor in a contest added to Tuesday's ballot after the unexpected death of Mayor Ed Lee in December.
The city has enormous wealth thanks to a flourishing economy led by the tech industry, but it's also plagued by rampant homelessness and deep pockets of poverty.
It is the city's first competitive mayoral race in 15 years, and one without an incumbent.
The leading candidates are London Breed, the African-American president of the Board of Supervisors who briefly served as interim mayor after Lee's death; Jane Kim, a San Francisco supervisor and daughter of Korean immigrants; and former state Sen. Mark Leno, who entered the mayor's race long before Lee's death, and who championed gay marriage statewide.
All three are Democrats, but Breed is backed by the establishment business community while Leno and Kim are favored by more liberal elements of the Democratic Party, including tenants and critics of tech companies such as Airbnb and Uber.
A fourth candidate, Angela Alioto, served as a supervisor in the late 1980s and 1990s and her father, Joe, was mayor from 1968 to 1976.
San Francisco uses a ranked-choice voting system. Voters rank their top-three candidates in order of preference. The candidates with the least votes are eliminated in rounds until there's a winner.
John Artnz, the director of the Department of Elections in San Francisco, says a winner might not be known until Friday, which is also the state deadline for counties to receive ballots postmarked by June 5.
"If it's very, very, very tight it might come down to every single ballot card," he said.
In 2010, Jean Quan became the mayor of nearby Oakland when she scored enough second- and third-place votes to beat the candidate with the most first-place votes.
In this race, Kim and Leno are deploying a similar tactic and have asked supporters to vote for the other as their No. 2 choice on the ballot.
The other candidates are Michelle Bravo, a massage therapist; Amy Farah Weiss, a homelessness activist; Republican businessman Richie Greenberg; and Ellen Lee Zhou, a public health worker who opposed recreational marijuana legalization.