Early on the morning of March 14, Kelly Berg went to her closet and picked out a bright red blouse. Until recently, she had rarely worn red, but she was heading to the Arizona State Capitol in Phoenix, and a red top would tell everyone exactly who she was: a teacher.

Red shirts and blouses had emerged as the official uniform of teacher uprisings against low pay that were spreading from West Virginia to Oklahoma and Kentucky under the rallying cry “Red for Ed.” Just one week earlier, a Facebook post by Noah Karvelis, a 23-year-old teacher in Phoenix, lit the spark in Arizona, asking teachers to wear red on March 7 to demand more money for the state’s chronically underfunded public schools. Within days, 6,000 people clicked that they were on board. Berg, a high school math teacher for 23 years with a master’s degree who was taking home $1,620 a month, was one of them. On the designated day, a Wednesday, thousands of Arizona teachers turned campuses red from the New Mexico line to California. Karvelis and other young teachers then took it upon themselves to keep the activism going, declaring every Wednesday Red for Ed day — but Berg decided to wear it daily. “I wanted people to come up and say: ‘Kelly, today isn’t Wednesday. Why are you wearing red?’ ” she said. “It was so I could tell them, This is how important it is. We need to make our voices heard.”

In the past, the idea of participating in anything that resembled a political movement had repelled Berg. “I would say, ‘Don’t talk to me about politics,’ ” she recalled. “ ‘I think it’s a waste of time.’ ” A 46-year-old lifelong Republican, she called herself a “sleepy voter,” as if she sleepwalked through the voting booth every four years. “I was just voting for the person with an R by their name or not voting.”

This was true even though the Legislature and governor — unified under Republican control since 2009 — cut education spending more than any other state in the wake of the Great Recession. Berg suffered doubly because her husband, a web developer, lost his state job, and now the entire family of six — they have four sons, ages 7 to 13 — was on her health plan, with the premiums cutting her previous take-home pay almost in half. She was working three extra jobs to keep the family afloat, arriving home most nights barely in time to check her kids’ homework and kiss them good night. Across the state, teachers were taking in roommates, working second and third jobs and leaving the profession in such waves that substitutes without standard certifications were leading more than 3,400 classrooms statewide. Two thousand more couldn’t be staffed at all.

In December 2016, the day before Christmas break, Berg heard that her son Mark’s sixth-grade teacher had quit to take a private-sector job for more money, and suddenly she felt that she couldn’t take it anymore. She needed to understand why Arizona’s schools were so poorly funded and who was responsible. She turned for help to her best friend, Tiffany Bunstein, who followed state politics closely and, like Berg, had been teaching for more than 20 years at Dobson High School in Mesa, a sprawling, demographically diverse suburb east of Phoenix. “I went to Tiffany and said, ‘I want to know what you know,’ ” Berg said.

Bunstein, 47, an active member of the teachers’ union and a Democrat, told her friend that she had once been uninformed, too. “Then when you start paying attention and you see what’s been happening,” she said, “it’s like clearing your glasses: Damn, this is what’s been going on all along?” With Bunstein’s encouragement, Berg began educating herself. She learned basic, and alarming, facts: Arizona ranked 49th in spending per student and seventh from the bottom in average teacher salary: $47,403. It had the highest average class size after Nevada, and amid national alarm over school shootings by troubled youngsters, Arizona school counselors had an average caseload of more than 920 students each, the highest in the country. Berg joined a new Facebook group called Arizona Educators United, where teachers posted articles and anecdotes about the school-funding crisis and the various politicians they blamed. She read about a teacher in Yuma, near the Mexico border, who quit his job after six years without a raise and now commuted an hour each way to a school in California — for twice the pay. The post that got perhaps the most “angry” clicks was an Arizona Capitol Times article quoting the House majority leader, John Allen, a Republican from Scottsdale, saying that teachers took second jobs not to pay bills but to buy boats or bigger houses.

It was on this Facebook page that Berg learned of the March 14 hearing in the House Ways and Means Committee on a bill related to Arizona’s tuition tax credit program, which awards dollar-for-dollar state tax credits to individuals and corporations for donations for private school scholarships. In the previous school year, donors had given more than $157 million, and over the last 20 years $1 billion, avoiding the same amount in taxes — money that never reached the state general fund or public schools. The bill would increase the size of individual scholarships, at a predicted annual cost of $2 million in 2020, a pittance in a more than $10 billion overall state budget. But for Berg and many other teachers emboldened by the March 7 show of solidarity, that was $2 million too much. “Once again we’re undercutting public education, and it needs to stop,” she recalled thinking. It was spring break, and teachers urged one another on Facebook to attend the hearing.

Berg drove downtown, her heart pounding. “This is totally so uncharacteristic of anything I’ve ever done,” she kept telling herself. Arriving at the Capitol, she found hundreds of other teachers, all wearing red, and was surprised by how comfortable she felt. Before she could stop herself, she volunteered to testify about the bill. She stood at the microphone with rows of red-shirted teachers behind her and read from notes, her head down, nervously smoothing her brown hair and adjusting her glasses. “I don’t know much about politics, but I do know about math,” she began, introducing a lesson on how teachers’ salaries had stagnated. Other teachers told stories of financial crises in their schools, pleading for every available dollar to go to public, not private, education. When one teacher’s voice broke as she described a colleague covering two kindergarten classes at once because of a shortage of substitutes, the others applauded in encouragement. When a Democratic lawmaker called the private scholarships inequitable — exceeding the state’s spending per public school student by $9,000 in some cases — the teachers stood up in silent assent. The committee chairwoman, Michelle Ugenti-Rita, instructed them to sit. “And when they sit, you can answer,” she said to the bill’s sponsor, the Senate president Steve Yarbrough, “because we’re going to all show each other respect.” Despite the entreaties of the teachers, the bill passed the committee on a party-line vote — six Republicans to three Democrats.

Berg went home, signed onto the Facebook page, which by now had tens of thousands of followers, and poured out her rage. “We were told to sit down when we stood in agreement. ... We were told to remain quiet when applauding when a teacher, who was in tears, was pleading for support for our classes and our students,” she wrote. “We were disrespected. We were mocked. We were listened to, but not heard.”

“That’s what radicalized me,” Berg said later. “As the kids would say, ‘I’m woke.’ ”

Public education is a $650 billion national enterprise, comparable to the U.S. defense budget, except that the federal government pays only 8.5 percent of the cost. States and local school districts split the rest in varying proportions, but each state finances it differently. Texas and Louisiana tap plentiful oil and gas revenues; Northeastern states like Massachusetts and New Jersey rely on high income and property taxes. Arizona, which hasn’t raised income taxes in more than 25 years, counts more on sales taxes and other revenues generated by a growing economy. However they pay for it, K-12 schooling is the biggest single expenditure for all states, accounting for 36 percent of general-fund budgets on average.

The Great Recession devastated education funding in every region of the country. With tax revenues plummeting, legislators and governors desperate to slash spending turned inexorably to public schools. Anticipating sweeping teacher layoffs, the Obama administration in 2009 sent states a federal stimulus package of $100 billion specifically for education, but the recession outlasted it. In half the states, according to the National Center for Education Statistics, teacher pay adjusted for inflation was lower in 2016 than in 2000.

Few states were hit as hard as Arizona, where the sun, low taxes and wide-open spaces had drawn transplants from around the country, fueling an economy heavily based on real estate development. All that came to a painful halt when the housing bubble burst in 2008. State revenue had grown so feverishly in the years before the crash that in 2006, Gov. Janet Napolitano, a Democrat, and the Republican Legislature were able to cut income taxes 10 percent even as they significantly increased education spending, including an expansion of kindergarten from half a day to a full day statewide.

The recession, coupled with the tax cuts, wiped out billions of dollars in state revenues. Napolitano left to join the Obama administration as secretary of homeland security in January 2009, and her Republican successor, Jan Brewer, and the Republican Legislature cut funds that districts relied on to pay teachers, maintain buildings, update curriculum and technology and much more. Salaries were frozen, funding for all-day kindergarten was eliminated and class sizes climbed year by year as teachers left for higher-paying jobs and principals were forced to combine orphaned classes. By last year, Shannon Connors, a sixth-grade teacher at a high-poverty, 98 percent Latino school in Phoenix, ended up teaching two classes at once — 50 students — when a succession of long-term substitutes failed to teach one of the classes effectively.

Similar situations had unfolded in every state where teachers walked off the job last spring. A 2017 study by the Center on Budget and Policy Priorities found that West Virginia, Oklahoma, Kentucky and Arizona — scenes of the largest teacher walkouts — were among the six states that cut the most aid to local school districts in the last decade. All are solidly Republican and have embraced small government and income-tax cuts. They are also right-to-work states where union membership is optional and unions are weak. Fewer than half of Arizona teachers belong to the union.

In Arizona, state funding per pupil has been below the national average since 1975, falling particularly after the mid-1990s, when lawmakers embarked on an almost unbroken streak of annual cuts in personal and corporate income taxes. Tom Rex, an Arizona State University researcher, calculated that if not for the cumulative effect of those tax cuts, the state general fund in 2016 would have totaled $13.6 billion instead of $9.5 billion, or more than 40 percent higher. Even in the depths of the recession, Brewer and the Legislature cut corporate income taxes 30 percent — roughly $550 million a year — in hopes of stimulating the economy, but without success. Voters approved a temporary 1-cent sales-tax hike in a 2010 referendum, with proceeds designated primarily for education, then decisively voted down a permanent extension in 2012.

The leader of the 2012 opposition to the sales tax was Doug Ducey, now the governor of Arizona, who was then the state treasurer. A former C.E.O. of Cold Stone Creamery and a Republican, he championed small government and free-market solutions to education like charter schools and Arizona’s version of private school vouchers. Attacking public school districts as wasteful bureaucracies, he argued that more money would solve nothing. “We need to spend those dollars more effectively,” he said at the time. “We don’t need to raise taxes on hard-working citizens.”

Cutting taxes and privatizing schools had long been popular in Arizona, but there were signs that the worsening teacher shortage was changing that. Beginning in 2015, the year Ducey took office, political polls showed education was the No. 1 concern for the Arizona electorate, even ahead of immigration and health care.

Kelly Berg, left, and Tiffany Bunstein, high school teachers in Arizona, wanted to find out why their schools were so poorly funded and who was responsible. Nick Oza for The New York Times

While keeping his no-new-taxes pledge, Ducey found some ways to increase school aid. In 2016, he won legislative and voter approval to give districts $3.5 billion over 10 years, mostly from a state land trust created at the time of Arizona’s founding and dedicated in part to funding public education. The move came after the Arizona Supreme Court found the state liable for failing to keep school funding even with inflation during the recession. Education leaders said the $3.5 billion came to less than was owed but embraced it as a way to funnel much-needed money to schools.

As the economy improved, Ducey restored some other funds eliminated during the recession, and districts began raising salaries modestly for the first time in eight years. But this barely dented the legacy of decades of cutbacks in both wealthy and low-income districts.

In January, Ducey unveiled his budget for 2018, specifying a raise of only 1 percent for teachers, along with some other aid that districts could apply to raises. On Feb. 22, news arrived of West Virginia teachers walking off the job to demand better pay and benefits. “My first thought was, They must be a union state,” Berg said. “But they weren’t, and I wondered what that meant for us.”

From one Wednesday to the next, more and more schools were turning red. The activism was loosely coordinated by a group of young teachers, including Noah Karvelis, whose Facebook post set off the first Red for Ed day on March 7. Teachers in districts across the state — including Berg — had stepped up to become liaisons and were organizing their own actions. The Arizona Education Association, the state union, was providing advice and financial support, but Arizona Educators United, the movement born on Facebook, was leading the mobilization. “They were creating a channel that people outside the union felt comfortable in,” said Joe Thomas, the A.E.A. president.

One Saturday, Berg and Bunstein rallied with hundreds of other teachers along Baseline Road, a major thoroughfare, wearing red and waving Red for Ed posters. Traffic snarled as drivers slowed to honk and shout encouragement. Supporters dropped off pizzas and cases of water. From the back seat of a minivan, children waved homemade signs saying, “We support our teachers.”

On March 28, another Wednesday, 2,500 teachers converged at a nighttime rally at the Capitol, which had been called by Arizona Educators United to announce the new movement’s demands. They included a 20 percent salary increase, raises for support staff, no new tax cuts until Arizona increased per-pupil spending to the national average, a pay scale guaranteeing salaries would continue to rise and a return to prerecession school-funding levels. That would require an increase of $632 per student — the current level was $5,105 — or about $700 million in additional spending, based on legislative budget data.

On April 2, teachers in Oklahoma and Kentucky walked off the job over pay and pension issues. Amid a clamor for action in Arizona, A.E.U. leaders invited community supporters to join them on April 11 for “walk-ins,” lining up outside schools before the opening bell and striding arm in arm to the entrance. More than 100,000 teachers, students, principals, parents and business owners participated at 1,100 schools.

The next day, Governor Ducey, who is up for re-election in November, called a news conference and announced that he had found room in his budget for a 20 percent pay increase for teachers over three years that he called “20 by 2020.” There would be a 10 percent raise this year, and — if future Legislatures approved the funds — 5 percent in 2019 and again in 2020.

A.E.U. leaders called the raises unsustainable without new taxes and again demanded a return to funding levels from before the recession — a decade earlier. They held a vote to decide whether to walk out, and 78 percent of more than 50,000 participating teachers and support staff voted yes. The date was set for April 26, near the end of the legislative session; the walkout would continue until lawmakers voted on the education budget.

The first morning of the walkout, Berg and Bunstein rode together into downtown Phoenix in Berg’s Honda Odyssey, past miles of flat, exurban expanses with mountains looming in the distance, wondering how many teachers would actually show up. At the designated meeting spot outside Chase Field, home of the Arizona Diamondbacks baseball team, they found so many people in red — teachers from affluent suburbs and the highest-poverty schools around Phoenix — they couldn’t see where the crowd stopped. Bunstein received an aerial photograph on her phone of a red sea surging 19 blocks down Washington Street from the ball field to the Capitol. It exceeded the scope of the camera, appearing to reach beyond the horizon. At about the same time, a deafening, celebratory roar went up from the crowd. Berg and Bunstein found themselves crying. So did many others.

Also in the crowd was Lupita Almanza, a Mesa teacher who had gotten only one minimal raise in eight years. Weighed down by student debt and her obligations as a single mother of a daughter in kindergarten, she had been agonizing about whether to leave her job. She thought often of how much she would be paid in the private sector. “I’m bilingual,” she said. “I could make good money as a translator.”

But something profound happened to her when she told her students she was walking out and wouldn’t be there the next day. “Saying goodbye to them was the hardest thing I ever did,” she said. “And I realized, if this hurts my heart so much, I should be doing this. I went to the Capitol every day of the walkout, and I fought, not just for my daughter or my nieces and nephews and students, but for myself too, because this is my passion — to be a teacher — and I just can’t close the door yet. I have found my voice.”

Far-right social-media sites including Breitbart and The Daily Caller searched Noah Karvelis’s online history and revealed shortly before the walkout that he had volunteered as a college student for Bernie Sanders’s presidential campaign and had tweeted about teaching students such topics as gender, race and “toxic/violent masculinity.” Republican lawmakers quickly tarred Red for Ed as a socialist plot — “cue Karvelis’ former boss Bernie Sanders,” Republican State Representative Maria Syms of Paradise Valley wrote in an op-ed in The Arizona Republic. When a high school music teacher in Tempe texted State Representative Kelly Townsend, a conservative Republican, asking to explore common ground, she replied, “When the teachers denounce the socialists in charge of your Red for Ed movement, and parenthetically I wondered why they chose the color red, then we can sit down and talk.” The teacher posted the exchange on Facebook.

The attacks seemed only to galvanize teachers. “They called us socialists, Marxists, communists! I’m a Republican!” said Kristina Carr, an elementary school special-ed teacher in Mesa. Red for Ed teachers seemed to be transcending every great divide in politics: They were Republicans, independents and Democrats, pro-life and pro-choice, Trump and Never Trump. In the Facebook group, they ganged up on anyone who brought up political party — or anything other than schools and funding.

“Let us band together, ‘conservative’ and ‘liberal,’ and WIN this war,” Jonathan Massey, an English teacher of 14 years and a Republican who said he often votes like an independent, wrote on Facebook. “After we have achieved sweet victory, we can resume attacking each other on other issues! Haha! WE are the kind of uprising which politicians of both major parties dread. They have lost control of us, and that means TROUBLE.”

For six days, teachers lobbied their lawmakers amid debate over the education budget. In the end, the salary increase survived intact, but the other teacher demands went nowhere. Democrats presented most of them as amendments; all were defeated by Republicans banding together. On the last day, the vote on the overall state budget dragged on into the morning. It was common for Arizona budgets to pass in the middle of the night with only a handful of spectators watching. But this time, when the final vote was taken at 5 a.m., the gallery was still packed and solid red with teachers.

Aidan Balt, 31, a high school English teacher and a Republican, had watched all night, growing increasingly distressed. She had been teaching for eight years at a school south of Phoenix where half the students are low income. She took home $2,200 a month, too little to afford to live on her own. She routinely worked 12-hour days and longer, trying to make up for what her students didn’t get from their underfunded school. During the budget negotiations, she met with one of her representatives, a Republican, to tell him in detail why the system needed more revenue. She said he was cordial but told her she didn’t understand the budget.

“You go meet a Republican lawmaker, and they say you don’t know what you’re talking about,” she recalled later, sipping passion-tea lemonade in a Starbucks. “But I do know what I’m talking about. This is something I’m an expert in, something I love and live every day.”

She said she identified strongly with the Republican Party. “I was raised to believe in personal freedom. I was raised around people with guns. I’m pro-life,” she said. “But over time my perception has changed. Politics shouldn’t be polarized. I’m not so black-and-white that I can’t see that sometimes I might have to vote differently because of other issues. For me, all I can do is focus on something I know, and that’s education.”

She was just one teacher in a red shirt, sitting among many others in the Senate gallery in the wee hours of a morning in May. But watching the party-line votes against the teachers’ demands, she felt compelled to take a stand. Pulling out her phone, she went to the online portal for the Arizona state government and changed her voter registration — at least for now — to Democratic.

On May 4, teachers returned to school with a new slogan: “Remember in November.”

Having failed to change legislators’ minds, the Red for Ed movement resolved to try to change the Legislature itself. A half-dozen Arizona teachers — and more than 25 others, current and retired, with education backgrounds — declared their candidacy for the State House and Senate with a promise to increase funding for public schools. They’re part of a sudden wave of educators on ballots as first-time candidates in every walkout state. In Oklahoma, more than two dozen of them survived the primaries, running as both Democrats and Republicans, in some cases defeating lawmakers who voted against a tax increase to fund their raises. In a stunning upset in Kentucky, a high school math teacher — one of more than 30 current and retired educators on the November ballot there — knocked off the House majority leader in the Republican primary in May.

Christine Marsh, Arizona’s 2016 Teacher of the Year, decided last year to run for the State Senate in a district straddling Phoenix and the affluent suburb Paradise Valley, against its moderate Republican incumbent, Kate Brophy McGee. On a sweltering day this past June, having just completed her 26th year in the classroom, Marsh was traversing several Phoenix housing developments, riding in a fellow teacher’s Prius, hopping out every minute or two to knock on voters’ doors to ask them for support.

“Teachers live by the mantra ‘Just close your door and teach,’ ” said Marsh, 52, who teaches high school English and calculated that she has taught more than 3,500 students. “If there were things we didn’t like, we shut out the outside world and did our job to the best of our ability. We’ve been systematically cut for 20 years, but the last 10 years, I came to the point I could not ‘Close my door and teach’ anymore. I’m running to get to the point where teachers can focus on our students and not be testifying before the House Education Committee.”

The G.O.P. holds a four-seat margin in the State Senate; Marsh’s district, a mix of Democrats, Republicans and independents, is one of a handful that Democrats have targeted as winnable in hopes of flipping Senate control. Republicans have controlled both houses of the Legislature for 25 years, except in 2001 and 2002, when the Senate was tied.

“We balance or flip the Senate, and there are no more budgets passed in the dark of night,” Marsh told a crowd of former students and parents gathered at a Scottsdale home in June. “With a 15-15 split, Republicans have to come to the table. It’s a game changer for the whole state.”

On Facebook, teachers encouraged one another to work for candidates who are dedicated to more funding for education — mostly Democrats but in some cases Republicans. Hoping to circumvent the governor and Legislature, they also embraced Arizona’s robust tradition of direct democracy, backing ballot initiatives to support public schools.

One of those referendums was already on the ballot for November, thanks to a statewide coalition of mothers and teachers who came together in the summer of 2017 in a precursor to this year’s grass-roots uprising. Calling their movement Save Our Schools Arizona, the cadre of women became overnight activists when Governor Ducey and the Legislature in April 2017 vastly expanded the state’s then-limited program of private school vouchers — known as Empowerment Scholarship Accounts — by making all 1.1 million Arizona schoolchildren eligible for them. Under the voucher program, the state loads an average of $5,700 onto debit cards and issues them to parents to use for private schools, home instruction and other alternatives to public school. Ducey described the measure as necessary for children who struggle to succeed in traditional settings. “Public education is about educating our public,” he said. Lawmakers limited the expansion to 5,500 new participants a year through 2022 to allay fiscal concerns. But the S.O.S. leaders argued that the Legislature could eventually lift the cap, triggering an exodus of students and revenue from public to private schools. With an all-volunteer force, in temperatures of 110 and higher, they gathered more than 100,000 signatures — well beyond the 75,000 needed — for what became known as Proposition 305, which blocked enactment of the voucher-expansion law until voters rule on it this November.

In the middle of the walkout, inspired by Prop 305, Karvelis and other Red for Ed leaders endorsed another ballot initiative called Invest in Ed, developed by the national and state teachers’ unions and liberal public-policy groups, that would raise $690 million a year through increased marginal tax rates on the state’s top earners. It would create a dedicated funding stream to restore all-day kindergarten, reduce class sizes, hire more counselors and continue to raise teachers’ pay.

Karvelis said he and the other leaders informally polled teachers amid the frenzy of the walkout, finding widespread support for the initiative. But the endorsement created fissures in the movement. “I thought this was a bipartisan fight for education,” Kris Leffler, a Mesa teacher and a Republican, wrote on Facebook. “Once the chant for higher taxes for the wealthy started, you lost this teacher’s support!!!!” The proposed ballot measure would almost double the marginal tax rate on the richest residents — individuals making over $500,000, couples making over a million dollars — from 4.54 to 9 percent, making it the fifth-highest rate in any state. “I don’t believe in that liberal thought,” Leffler said. Other Republican teachers renounced Red for Ed on the same grounds. Jonathan Massey, who cautioned against partisanship from the start, lamented what he called “the loss of our trademark” but didn’t leave the movement.

Those backing the measure argued that it would make the system more fair because the state budget now relies heavily on sales taxes, which disproportionately burden low-income residents. Berg said she would have preferred a broader-based tax but was moved by the bottom line of having more money for schools. So was Jenna Kaderlik, a Republican teacher from Surprise, a Phoenix suburb, who took a $15,000 pay cut when her family moved from Texas. “The ballot initiative really called to me — a dedicated, sustainable revenue stream every year,” she said. “It’ll be voter-approved and voter-protected. The Legislature and the governor can’t touch it.”

They and thousands of other teachers across Arizona spent evenings and weekends collecting signatures; Berg took charge of distributing petitions to other teachers every Saturday morning across the Mesa school district. On one Saturday in June, she and Bunstein spent three hours collecting signatures at a coffee shop called Xtreme Bean in a busy shopping strip. Later that day, they moved to a bar and grill in Tempe, where they ran into S.O.S. activists from the previous year’s battle for Prop 305. With their cause already on the ballot, S.O.S. was helping out supporters of Invest in Ed and a third referendum called Outlaw Dirty Money. It would require so-called “dark money” groups that funnel millions of hard-to-trace dollars into Arizona political campaigns — mostly Republican but also Democratic — to reveal their individual donors. The parents and teachers who took on the voucher law had become intimately familiar with these groups.

“If you cared last year about vouchers, and this year about the walkout, you need to ask the next question: Where did this issue come from?” said Dawn Penich-Thacker, a communications professor at Arizona State University and an S.O.S. founder who was coordinating volunteers at the bar and grill. “And that takes you to dark money.”

In 2016, the Brennan Center for Justice at N.Y.U. School of Law issued a report called “Secret Spending in the States,” finding that dark-money political contributions in Arizona increased from about $600,000 in 2010 to more than $10.3 million in 2014, the year Ducey was elected governor.

Ducey had become a presence at conferences organized by the billionaire brothers Charles and David Koch and donors to their political-finance network when he was state treasurer. An organization called Americans for Responsible Leadership, whose funding was traced by California authorities to the Koch network, contributed almost $1 million in support of Ducey’s successful campaign against the 1-cent sales-tax hike in 2012.

In his 2014 gubernatorial campaign, Ducey ran on a pledge to cut taxes every year and drive income tax rates in Arizona “as close to zero as possible.” That year, six dark-money groups spent almost $3.5 million supporting him or attacking his opponents, according to an investigation by The Arizona Capitol Times. Citing tax records, the paper found that five of the groups were financed by the sixth, American Encore, run by the Arizona political consultant Sean Noble, who was known to have funneled more than $100 million from anonymous Koch-network donors into political causes in 2012. “Our network will work with anyone to help remove barriers that are preventing students from reaching their potential,” Meredith Olson, an education spokeswoman for the Koch network, wrote to The Times in an email.

In 2017, the Koch brothers’ political advocacy arm, Americans for Prosperity, named the Arizona voucher-expansion bill its No. 1 education-reform priority in the country. The American Federation for Children, another bundler of anonymous contributions, founded by the family of Secretary of Education Betsy DeVos and focused on expanding school choice through charter schools, vouchers and private school scholarships, made it their top priority in the state.

A sea of ‘‘red for ed’’ Arizona teachers on their way to the state capitol in phoenix on the first day of the walkout, april 26, 2018. Ralph Freso/Getty Images

Charles Koch and five members of the DeVos family have each given the maximum $5,100 to Ducey’s gubernatorial campaign this year, according to filings with the secretary of state.

When the expansion of vouchers passed in 2017, DeVos tweeted congratulations from her official account: “A big win for students & parents in Arizona tonight.... I applaud Gov. @DougDucey for putting kids first.”

The DeVos and Koch networks quickly went to work to undercut Save Our Schools and its campaign to overturn the new law through a public referendum. Christine Marsh, the 2016 Teacher of the Year, had just declared her candidacy for the State Senate and was featured in a photograph on social media collecting signatures for the S.O.S. referendum. Soon afterward, more than 11,000 households in her district received robo calls from a female voice: “I’m calling from American Federation for Children with an alert about an election scandal in this district.” Marsh, the voice said, had “circulated a petition sheet, which was later falsified and filed with the Arizona secretary of state, a felony. . . . Christine, stop hiding behind the Fifth Amendment and come clean. Come clean, Christine.” To support the “felony” claim, A.F.C. lawyers enlarged the social-media photo of Marsh, showing that she had not indicated on her petition whether she was a volunteer or a paid contractor. When submitted, the petition had an X in the volunteer box. In response to the A.F.C. claims, the attorney general reviewed the complaint but found no wrongdoing.

For weeks after leaders of Save Our Schools delivered their petitions to the secretary of state, a phalanx of activists from Americans for Prosperity and the American Federation for Children submitted multiple daily objections to individual signatures, according to Roopali Hardin Desai, an attorney who represented S.O.S. When the state nonetheless certified more than enough signatures as valid, lawyers representing the Koch network filed legal challenges that went all the way to the State Supreme Court but ultimately failed. Desai estimated that the voucher proponents spent as much as $500,000 on legal fees. But since Arizona law does not require such groups, known as social-welfare organizations, to disclose expenditures or individual donors in campaigns over ballot access, she said, “I have no idea where it came from, who was paying or how much it was.”

The school-choice movement in Arizona has fought to keep charter and private schools lightly regulated, arguing that too much state oversight would stifle innovation. In 2017, the Grand Canyon Institute, a nonprofit research organization, found that more than 77 percent of charter schools in Arizona use state funds to do business with for-profit companies owned by the charter holder, a member of the charter board or their relatives. With 18 percent of Arizona public school students in charters, the highest percentage of any state, David Wells, the institute’s research director, reported that charters spent half a billion dollars in 2013-14 on these “related-party” transactions, which are illegal in public school districts.

One charter engaging in related-party transactions is Benjamin Franklin Charter School, owned by State Representative Eddie Farnsworth, a Republican, who has received regular infusions of campaign support from the American Federation for Children — more than $8,000 in his recent primary campaign, according to filings with the Arizona secretary of state. Farnsworth, who votes on charter school legislation despite his direct interest in one, owns a real estate firm from which B.F.C.S. leases its four campuses, according to records assembled by a watchdog group, Arizonans for Charter School Accountability. When the group complained that B.F.C.S. does not hold board meetings, the Arizona attorney general’s office found that the state’s open-meetings law does not apply because Farnsworth is the board’s only member.

Steve Yarbrough, the president of the Arizona Senate, a Republican who is retiring this year, was for years the prime legislative champion of the state program that provides tax credits for donations to private school scholarships. He also benefited personally from it. By law, donations go directly to so-called School Tuition Organizations, which then award the scholarships, and Yarbrough was until January the executive director of the state’s biggest S.T.O., the Arizona Christian School Tuition Organization. (He was succeeded by his son Scott.) Under Arizona law, S.T.O.s can keep 10 percent of all donations. A.C.S.T.O. paid Yarbrough $129,649 in fiscal year 2017. A.C.S.T.O., a nonprofit, outsourced services like data entry and information processing to a for-profit company that Yarbrough co-owned with his wife and another couple. That company charged the nonprofit $672,453 in 2017 and millions of dollars combined over the previous decade. The Arizona Republic reported in 2015 that Yarbrough, in addition, was A.C.S.T.O.’s landlord, receiving $52,000 a year in rent.

He also served as chairman of the Senate Ethics Committee.

“It’s blatant that a number of lawmakers have something to make off of charters and private schools,” said an infuriated Aidan Balt, the formerly Republican teacher who changed her registration. “Who puts up with that? We do! Arizonans put up with that!”

Berg worked all summer as co-principal of Mesa’s high school summer program, one of her three extra jobs. She and Bunstein also set up shop on Saturdays at 8 a.m. at a popular health-food restaurant called Pita Jungle to distribute petitions to teachers helping to collect the 150,000 signatures needed to get the Invest in Ed tax increase on the ballot. After the July 5 petition deadline, they passed out windshield stickers for the anti-voucher referendum in blistering hot, busy parking lots, taking periodic breaks under a tent.

As a result of the increase approved by the Legislature — with a huge shove from Red for Ed — Berg got a $6,000 annual raise, the biggest of her career. Her husband recently got a new job with generous health benefits. Beginning Oct. 1, for the first time in years, she’ll no longer be carrying the whole family of six on her health plan, adding $1,600 a month to her take-home pay. That, with her raise, allowed her to quit the community college job that had taken her away from her children three nights a week.

Out on the campaign trail, Ducey was touting the pay raise as a signal accomplishment, along with other increases in state support to school districts. In November, he faces the Democrat David Garcia, an education professor at Arizona State University who won the Aug. 28 primary with a ringing call for more education funding.

Ducey emphasized in one appearance after another that he made these changes while standing firm against a tax increase. He criticized the Invest in Ed initiative to hike taxes on the rich, along with its underlying argument that Arizona needs to raise more revenue to fund public education adequately. He pointed out that surging economic growth in the last year helped finance the raises. “I don’t know why we’d raise a tax when we have such overwhelming revenues coming into our general fund,” he said in an interview. “That would be the equivalent of hanging out a sign in Arizona that we’re no longer open for business.”

But as soon as school reopened, teachers began filling Facebook with evidence of all that remained unaddressed. They wrote of children sweating in buildings with broken air-conditioners their districts couldn’t afford to repair, of a special-ed class being held in a trailer with a bullet hole in it. They wrote of spending $400, $500 and even $1,500 of their own money on classroom supplies. Christine Marsh, the State Senate candidate, posted that she had 37 students in one freshman English class. “Teachers have to solve systemic problems on their own,” she wrote. “We’ve been doing this for years, but Arizona’s children are entitled to a better system.”

Berg, who returned to Dobson High on Aug. 2, was in her empty math classroom for a prep period on Aug. 21 when a mass email showed up on her phone: The secretary of state had certified the Invest in Ed signatures, and the measure was officially on the Nov. 6 ballot. It now had a name: Proposition 207. “I cried, I got goose bumps, I shared it on Facebook, I felt grateful for everyone who helped,” she said. “And then I got right to work” on plans to mobilize support.

In a stunning development, however, the Arizona Supreme Court ruled on Aug. 29 that Proposition 207 could not appear on the November ballot. The justices’ finding was that the wording of the initiative inadvertently repealed the indexing of Arizona tax brackets to inflation and would eventually raise taxes on all Arizonans, not just the rich. Sponsors of Invest in Ed had successfully contested this interpretation in a lower court, but the justices found “a significant danger of confusion or unfairness,” invalidating the petitions signed by more than 270,000 Arizonans to put the tax increase on the November ballot. The order cannot be appealed.

In a separate decision the same day, the justices upheld a lower-court ruling that invalidated petitions for the Outlaw Dirty Money initiative, disqualifying it from the ballot as well. The state director of the Kochs’ A.F.P. was a plaintiff in the Outlaw Dirty Money case, and the Arizona Chamber of Commerce and Industry filed the challenge to Proposition 207. “This has been a great day for taxpayers,” said Tom Jenney, an executive of the Arizona branch of A.F.P. “It’s been a great day for everyone looking out for freedom.”

Teachers reacted with fury on the Arizona Educators United Facebook page, accusing “Ducey’s stacked supreme court” of subverting democracy. Ducey expanded the high court in 2016 from five to seven justices, of whom he has appointed three. Teachers of every political stripe called on one another to work in November to defeat all politicians opposed to more funding for education. “The ONLY way out of this . . . is to collectively — Republican, Democrat, conservative, liberal — unite and vote for the same candidates,” wrote Heather Gookin, a fourth-grade teacher and registered independent. “If politicians insist on inserting themselves into our classrooms, we need to insist that we let the right ones in.”

Teachers who last year couldn’t identify their legislative district were crowdsourcing information on their state senators’ and representatives’ education records, their dark-money donors, their comments at meet-and-greet sessions. Whether Democrats, Republicans or independents, they said they were being deluged with requests for advice — from neighbors, friends, relatives, day care providers, kids’ soccer coaches, gym buddies, even people at dog parks — on whom to support for governor and the Legislature.

Berg said no one had ever asked her before how to vote in an election, nor could she have answered intelligently. But now she can, and she does. “We are educators who learn for a living and try to make a better world through our classrooms,” she said. “Why wouldn’t we gather, focus, research and teach others what we have learned about Arizona politics?”/•/