The congressional midterm elections are less than six months away, and while a string of successes in special elections has given Democrats reason for optimism, just a few small shifts in distant counties could mean the difference between a drenching Democratic wave and an ineffectual ripple.

If they hope to bring new policy priorities to Washington and provide a more forceful check on President Trump, Democratic candidates don’t just have to beat their Republican opponents, they also have to overcome America’s slanted electoral system, with its gerrymandered boundaries and a baked-in rural bias. A tall task, but not impossible.

What will it take for the House or Senate to change hands? Which polls should you track? Here’s a quick overview.

Democrats can’t just win, they have to win big

Advertisement

Democrats seem to be in a good position, judging from the results of recent special elections and other off-cycle contests. On average, Democratic candidates in 2017 and 2018 have claimed a higher share of local votes then either Hilary Clinton did in 2016 or Barack Obama in 2012.

Get Today in Politics in your inbox:

A digest of the top political stories from the Globe, sent to your inbox Monday-Friday.

Meanwhile, Republican incumbents are retiring at an unprecedented rate, leaving open seats which should be easier for Democrats to claim.

Yet, it wouldn’t take much to change the momentum. Especially since winning isn’t nearly enough for Democrats. They have to dominate, if they expect to win back the House or Senate.

Let’s start with the House, which is the easier task — and still full of pitfalls. Right now, more people across the country say they plan to vote for Democratic candidates than Republicans, but securing more votes might not be enough. After all, control of the House isn’t decided by a national tally; it hinges on the outcomes of 435 individual races. And district-by-district, Democrats are at a double disadvantage.

There’s gerrymandering, for one thing, which has allowed state-level Republicans to maximize the number of safe seats for their slate. Second, Democrats tend to cluster together in cities, which ends up wasting a lot of votes — because instead of spreading enthusiasm across candidates in need, it piles up in one place and fruitlessly runs up the margin of victory for urban candidates who only need 50.1 percent of the vote but get 80 or 90 percent.

Advertisement

The general consensus among voting experts is that Democrats will need to win the national vote by at least 7 percentage points in order to capture a majority of House seats.

Taking the Senate is a whole different problem. This cycle, Democrats happen to be defending a number of tough seats in deep red states, with few counter-opportunities to oust incumbent Republicans. At particular risk are a handful of Democratic senators in states where Trump dominated, including Joe Manchin in West Virginia, Claire McCaskill in Missouri, and Heidi Heitkamp in North Dakota. Trump’s summer plans apparently include rallies in the home states of these and other vulnerable senators, to help ensure their defeat.

Predicting which predictions will come true

Pollsters have a lot to prove, after a 2016 cycle in which they mostly failed to foresee Trump’s victory. But if anything, midterm elections are harder to assess. There are just too many races, too few pollsters, and the statistical problem of figuring out what counts as a meaningful sample of likely voters in small states and idiosyncratic districts.

And this time around, pollsters face the additional task of figuring out how Trump’s unpopularity might affect turnout. Midterm voters tend to be older and whiter, but it’s not impossible to imagine the Trump “resistance” motivating younger, more diverse voters. And those special elections have given some indication of spiking Democratic turnout.

With challenges like these, the polls probably won’t have enough precision to say much about the fate of the Senate. The key races are likely to be too close, and the universe of possible outcomes too vast.

Advertisement

But there’s a workaround for the House. Instead of polling candidate by candidate, or district by district, you can just ask folks around the country: Do you support the Democrat or the Republican for Congress?

It’s called the generic ballot, and it works because while each individual race may be idiosyncratic — based on the personalities of the candidates and the winds of local change — there are enough contests in enough different places that these local details mostly wash out.

As of Sunday, Democrats hold a 45.8 percent to 40.3 percent lead in the generic ballot, which falls short of the 7-percentage-point lead they’ll likely needed to win back control. What’s more, their advantage has been shrinking, down from a high of 13 points after the Republican tax cuts passed in late December.

There’s ample time for shattering surprises, too, whether it’s a late-summer recession, revelations from the Mueller probe, or a historic peace agreement with North Korea.

But that’s the tricky thing with elections: Outcomes can be upended by world-historic happenings, but also by slight shifts — like the 80,000 votes across three states that handed Trump the presidency.

The generic ballot and state-by-state polling can provide a general sense of what to expect in November, but there is no real certainty until the final results are in.

Evan Horowitz digs through data to find information that illuminates the policy issues facing Massachusetts and the U.S. He can be reached at evan.horowitz@globe.com. Follow him on Twitter @GlobeHorowitz