National Democrats are hoping to capitalize on the education funding consensus during this fall’s midterm elections, especially in states with key House and Senate races, like Arizona and West Virginia. Though most school funding comes from state and local sources, not the federal government, congressional Democrats have released a plan to repeal the Trump tax cuts for the top 1 percent of earners in order to spend $50 billion on teacher pay and recruitment and another $50 billion on school infrastructure needs.

“Teachers have huge impact in their communities, and they are mobilized and they realize the Democrats are on their side and Republicans have not been,” said the Senate’s Democratic leader, Chuck Schumer of New York. “The No. 1 way you can get better teachers is teacher pay. Even some Republicans realize that. It’s sort of a free-market concept.”

In Kentucky, Travis Brenda, a high school math teacher, defeated the speaker of the State House of Representatives, Jonathan Shell, in the Republican primary. Mr. Shell had drawn the ire of the teacher movement by backing a plan to make educators’ retirement plans more like the 401(k) accounts used in the private sector, and by passing a budget that teachers said devoted too little money to prekindergarten programs, textbooks, school transportation and teachers’ professional development.

Support for teachers hasn’t always translated into support for more education funding — at least when that funding meant higher tax bills. Oklahoma, for example, repeatedly cut taxes, leading to stagnant teacher pay, aging textbooks and a four-day school week in some rural districts. In 2016, voters there rejected a ballot initiative that would have imposed a 1 percent sales tax to help fund public schools. The teacher protest movement, which mounted a nine-day walkout, won an average raise of $6,000 per year for teachers, funded through new taxes on oil and gas production, online sales, gambling, tobacco and motor fuels.

The walkout movement first took hold in West Virginia among rank-and-file educators who organized on Facebook, but quickly became closely tied to unions, which provided much of the organizing and lobbying muscle. While the Times survey found broad support for teachers, opinions on their unions were split, with 34 percent of adults saying unions are “part of the problem” with public education, and an equal number saying unions are part of the solution. Views on teachers’ unions showed a clear partisan split, with a majority of Democrats in favor of unions and a majority of Republicans opposing them.

Doug Brown, a firefighter in Phoenix, where tens of thousands of picketing teachers rallied for a week at the State Capitol in April and May, said that educators deserved the raise they had won from state lawmakers, but that they had been too quick to strike.