The party in power (in a State government) can either maximize the number of seats it has, or make seats safe. It cannot do both at once!
Maximizing seats -> minimizing the margin of victory in each district -> increasing likelihood of losing its majority in a future election!
Making seats safe -> maximizing margin of victory in each district and minimizing the number of seats by concentrating the majority's voters -> minimizing margin of victory in the popular houses (of the State legislature and Congress) -> increasing likelihood of losing its majority in a future election!
That is, no matter how you redraw district borders, as long as population per-district is roughly even (in each State), then you cannot get a long-lasting advantage.
This will probably be surprising to some here, but it's clearly true.
This means that Gerrymandering is a much smaller evil than one might think.
I would further argue that Gerrymandering is not an evil at all. It is part and parcel of the Republican system of government in the U.S.:
- the Senate, especially when Senators were selected by State governments, and still now due to its 6-year terms and staggered elections, modulates the popular House
- first past the post leads to a small number of parties and reduces party power (you vote for a person, not just a party as in the case of proportional representation systems)
- gerrymandering also modulates popular will
- juries modulate law and prosecutors
- the president is selected by the Electoral College, which also modulates popular will
- the States have police power, which modulates Federal power
- the Courts modulate Congress and the Executive branch
These things were well thought out by the Founders! They were arrived at by compromise. They weren't accidents born of ignorance of mathematics or science. This system has served us well. Changing it requires broad consensus, which requires strong arguments. So far I've yet to see any decent arguments against this structure.