Kansas Republicans on Tuesday rebuffed the Senate bid of Kris W. Kobach, a polarizing figure in state politics and a staunch ally of President Trump’s. The result was a major relief to party leaders in Kansas and Washington who had worried that he would uniquely jeopardize the seat in the general election.Representative Roger Marshall, a conservative congressman from rural western Kansas, won the primary, The Associated Press reported, and will face State Senator Barbara Bollier, a former Republican herself, in November.Kansas was one of several states, including Missouri, Michigan and Arizona, holding some of the last remaining primaries before November’s general election. It was another test of the mail-in voting systems that many states are relying on during the coronavirus pandemic. The lack of immediate results in some places was yet another precursor of what is likely to unfold in the general election, when the reliance on absentee voting systems could delay results past Election Day. That dynamic was evident in on Tuesday in New York, where, six weeks after Primary Day, the New York City Board of Elections delivered long-awaited victories to two Democrats: Ritchie Torres, a 32-year-old New York City councilman, who won a 12-way Democratic primary for a soon-to-be open House seat, and Representative Carolyn B. Maloney, a longtime incumbent. The expansive use of vote-by-mail in New York was viewed by some as a test of whether the nation is ready for November. Mr. Kobach, a former Kansas secretary of state known for his hard-line views on immigration and voting rights, was seen by party leaders as an especially weak potential general election candidate, even in a state that has not sent a Democrat to the Senate in 88 years. In the 2018 governor’s race, Mr. Kobach lost to Laura Kelly, a Democrat, and heading into this week’s contest, Senate Republican polling showed that nearly 30 percent of Republican primary voters indicated they would support Ms. Bollier in the general election if Mr. Kobach were the nominee.It is possible that the race could still be in play this fall, as Republicans confront a challenging political landscape shaped by disapproval of Mr. Trump’s leadership during the coronavirus crisis. But Republicans and Democrats alike expected the state to be much more competitive if Mr. Kobach had won the nomination. The contests were a microcosm of several national political themes the parties are confronting, including the embrace of Republican candidates fashioned in the style of Mr. Trump, the progressive push to unseat more centrist House Democrats, and another trial run for the mail-in voting system that has become a lifeline for states struggling to deal with the pandemic. On the Republican side, the Kansas Senate race in particular offered another reminder that the party divisions that existed before Mr. Trump won will persist even after he leaves office. That includes the disagreement between deeply conservative activists, who are skeptical of Washington and approve of the type of white identity politics Mr. Trump has embraced, and the party’s traditional establishment — many members of which have argued that such messaging hurts the party long-term.In Missouri, Representative William Lacy Clay, a 10-term Democratic congressman, faced a rematch against Cori Bush, in a significant test of the power of the party’s progressive wing. States handled the election activity Tuesday with moderate success, as Americans continued to show a degree of comfort with mail-in and absentee voting systems even as Mr. Trump and his allies have sought to sow distrust. In Michigan, where Representative Rashida Tlaib’s bid to win a second term in Congress was the most closely watched but where there was also an open House seat, more than 1.5 million voters had turned in an absentee ballot by late Tuesday afternoon, according to election officials, a sizable portion of the total electorate. The contests unfolded at a moment of extraordinary turmoil in the nation, capping a summer defined by a pandemic and economic crisis, as well as a national outcry over racism and police brutality. And on both sides of the aisle, the races tested enthusiasm for voting amid a public health crisis. In Detroit, Corlette Selman, 59, a hair stylist wearing a Black Lives Matter mask, said she felt as if she were voting for her life on Tuesday.“What’s most important for me is to get the proper people in place to take over the Senate, to maintain the House and to get us a new president, because we can’t live like this anymore,” she said.A statewide race for a Democrat in Kansas is always an uphill battle. But after the moderate Kansas City suburbs sent a Democrat to Congress in 2018, and as Mr. Trump faces a backlash even in red states, Republican strategists have grown increasingly uneasy about the contest over all — though many observers’ fears were especially concentrated on the prospect of a Kobach nomination.Mr. Kobach, who has run for office multiple times, has long been a controversial figure in Kansas. He has cultivated a devoted conservative following but has also alienated more centrist Republicans.Throughout the race, he sought to paint his lead primary rival, Mr. Marshall, as too moderate and insufficiently supportive of the president. Mr. Marshall, who is in fact deeply conservative especially on social issues, fought those characterizations at every turn while the Senate Republican leadership implored Mr. Trump to endorse Mr. Marshall and block Mr. Kobach. The president did not do so, fueling tensions between Capitol Hill and the White House.Last week Mr. Kobach, in effect, received some help from Senator Ted Cruz of Texas, who during an Air Force One flight with Mr. Trump sought to steer him away from a Marshall endorsement. He reminded the president that Mr. Marshall had supported former Gov. John Kasich of Ohio, now a vocal Trump critic, in the 2016 presidential primary.Mr. Marshall was not the original top choice of party leaders, who had hoped that Secretary of State Mike Pompeo, a former Kansas congressman, would enter the race.When Mr. Pompeo declined to run, top Senate Republicans rallied around Mr. Marshall, as did a range of influential organizations, a list that included the U.S. Chamber of Commerce, the Kansas Farm Bureau and several anti-abortion groups. He also received the backing of the former Kansas senator Bob Dole, who remains a beloved figure in his home state.Mr. Marshall made clear that one of his biggest concerns was the crowded field, with a list of rivals that also included Bob Hamilton, a businessman who started a successful plumbing company and has lent his campaign several million dollars. (His slogan: “Send in a plumber to drain the swamp.”)That dynamic made the race fluid and unpredictable in its final days. Complicating matters further: An outside group, which appears to be linked to Democrats, had been advertising heavily and attacked Mr. Marshall in an apparent effort to elevate Mr. Kobach.