The mathematician in me chuckles every time they bring up gerrymandering. Everybody thinks they know how to spot gerrymandering but they are usually mistaken. They see a district that has a contorted boundary and say, Aha! Gerrymandering! However, the definition of fair district representation is one that reflects the demography and voter registration of a state as a whole. Districts must be weighted with voters and demographics. It’s not just spatial topography. Consider Illinois, an easy example which has one large metro. The state is 56% Democrat in registration. How would you construct a perfectly gerrymander-free state map? Northeast is Chicago where most Dems and blacks reside. The rest of the state is R and suburban or rural. If you were to construct entirely rectangular districts with a high density of small rectangular districts in Chicago, you’d still be quite gerrymandered. There is hardly any black representation in the larger part of the state. (well, okay, East St. Louis but that's just 55,000 people nowadays) Chicago is heavily Democratic. Hence the Chicago districts would vote D but the thin D-population in the other districts would probably make them become R districts. And that results in majority R representation for the state. You’ve done the thing that gerrymandering has always achieved for the party in power. The opponents are forced into “ghettos” that vote highly their way. The rest of the districts then distribute the remaining opposition voters into defeatable portions. So if Illinois is 56% D and has 15 districts but the 6 districts of Chicago contain 75% Ds, the other 9 districts would be 55-45% R’s, and the state delegation would be, counterintuitively, 9 R’s and 6 D’s.
The “Fair” thing would be to have districts whose boundaries are like rays that begin in Chicago and extend across the entire state. Thus an equal proportion of blacks would live in all districts as well as 56% Ds vs. 44% Rs. But here lies the irony. Nobody wants this. If blacks have less than 20% representation in all districts, they would find elections difficult and there would likely be very few black representatives—unless like Mia Love of Utah, you are a conservative that gets white votes moreso than even blacks. That is, there would be no black “safe” districts. Secondly, politicians would hate campaigning simultaneously in Chicago and Cairo. Perfect demographics (that you can solve with a computer) makes for hard politics and pricey advertizing.
Because D’s tend to gather in small areas of large metros, and engage in identity politics, they will be forever tormented by gerrymandering. But in fact this may have been what the Founders envisioned when their constitution installed the Electoral College and the Senate that would not allow, as Madison called it, “one corner of the country to rule us all”.