Gerrymandering is named after both Governor Gerry who signed a bill that redistricted Massachusetts in 1812 to benefit his own party and the mythological salamander because one district was so distorted that it resembled the shape of salamander. Gerrymandering is a very complicated technique in modern politics. When teaching this in political geography, I often use this chart below, which was published in Washington Post Wonkblog (2015) and adapted from a Reddit post.
This overly simplistic chart effectively conveys the essence of Gerrymandering to those who are confused about this concept. In reality, however, partisan gerrymandering is hard to prove since it is hard to measure. If the effect of gerrymandering is proved to unfairly favor one party and discriminate against another, it may be easy to rule on this case. But, how do you measure the effect exactly? The effect can be measured against the condition when there is no such a practice with partisan intention. Since the reality is singular, we may need to simulate alternative realities to compare results in the presence with those in the absence of gerrymandering, as this paper did. Another way, the way presented to the Supreme Court, is efficiency gap. In general, efficiency gap is the difference of wasted votes by each party divided by the total number of votes.
If you want to know more about this Supreme Court case, MonkeyCage published an analysis piece.