Is a blue wave coming? That’s the question swirling around Washington ahead of the mid-term elections in November. Though still nine months away, Democrats are hoping they can wrest back power over the Republican-controlled House of Representatives and Senate when Americans go to the polls on November 6th.

This week a special election to fill a seat in the state legislature in Florida was won by a Democrat, the latest red-to-blue switch since the election of Donald Trump. That the Democratic victory took place in a district which voted for Trump by a five-point margin in the 2016 presidential election is an encouraging sign for Democrats, who are hoping to benefit from an anyone-but-Trump wave.

In total, Democrats have flipped 36 Republican-held seats since Trump’s election, a pattern they’re hoping to replicate in the mid-terms. The party out of power traditionally performs well in mid-terms. Coupled with Trump’s historically low approval ratings (despite a bump in support for Republicans following the recent $1.5 trillion tax package), and Democrats are hoping for a breakthrough in November.

But as party operatives begin to hone in on candidates and constituencies ahead of the primaries, there is another quirk of the American electoral system to contend with.

More than 100 years after Massachusetts governor Elbridge Gerry redrew the electoral boundaries of the state to benefit his own party, creating the term gerrymandering, the practice is alive and well in the United States.

Several high-profile cases on the issue have come before the US supreme court, with the nine-member court due to hear four gerrymandering cases this term.

One of these involves Wisconsin. While Democrats won nearly 52 per cent of the vote in the state assembly election in 2012, they took just 39 of the chamber’s 99 seats. Like many legislatures across the country, the imbalance was a result of redistricting undertaken by Republican-controlled states following a wave of wins by the party in 2010.

It is not all the fault of Republicans though. Another case under consideration by the supreme court was taken by Republicans in Maryland. They claim that Democrats redrew Maryland’s 6th congressional district in 2011 to help their candidate unseat the sitting Republican in House of Representatives elections.

Spotlight on Pennsylvania

This week, Pennsylvania was in the spotlight. The state is widely regarded as one of the most heavily gerrymandered in the country. Republicans have long held 13 of the state’s 18 seats in the House of Representatives – despite Democrats winning more votes than Republicans in the 2012 election.

Last month the state’s supreme court struck down the Republican-drawn congressional map, noting that the boundaries “wander seemingly arbitrarily across Pennsylvania” and ordering the Republican-controlled state legislature to produce a revised map.

This week the state’s Democratic governor, Tom Wolf, rejected the new version, arguing that it still amounted to gerrymandering. He may now produce his own map, though competing versions from Democrats and Republicans were being prepared late this week.

Significantly for Pennsylvania, the new map is likely to be in place before this year’s mid-terms, putting Democrats strongly in the running for at least one extra seat in Congress.

But for most states, the real change will be further down the line. Every 10 years the US census takes place, producing data that is then used to redraw electoral boundaries. The next census takes place in 2020, which means that whichever party wins in the 2018 and 2020 elections at state and governor level will be in control of the redistricting process.

Both parties have launched redistricting groups in a bid to influence congressional and state legislative boundaries after 2020.

Another contentious issue is racial gerrymandering. In a landmark ruling last year, the supreme court found that two districts in North Carolina had been gerrymandered on racial grounds in an effort to dilute the black vote. A similar case involving accusations that Texas redrew its congressional maps on racial grounds is due to be heard shortly.

Together with concerns about voting rules that disproportionately disadvantage black Americans – most of whom vote Democrat – and other minorities, the issue is a political minefield.

There are signs that former president Barack Obama may take up the issue. He raised the matter during his final State of the Union speech, telling Congress: “We have to end the practice of drawing our congressional districts so that politicians can pick their voters, and not the other way around.”

A Democratic redistricting group led by former attorney general Eric Holder is backed by Mr Obama, and there have been reports that he may visit key affected states ahead of the mid-terms.

For those Obama supporters disappointed by his progress on voting rights during his presidency, many will be hoping that fair political representation will be his post-presidency legacy.