Every ten years after the federal census, states are required to redraw the boundaries of their congressional and state legislative districts to ensure they remain equal in population. Each state has a different way of redistricting, and in Pennsylvania, congressional boundaries are determined by the General Assembly while state House and Senate districts are drawn by a five-member bipartisan commission. See Ballotpedia's primer on redistricting for an overview of the redistricting process in states across the country. For more on Pennsylvania, see this 101 guide by the nonpartisan Fair Districts PA coalition.
Gerrymandering: DRAWING CROOKED LINES
In many states including Pennsylvania, the redistricting process has proven highly vulnerable to gerrymandering, when districts are redrawn to give a certain parties, office holders or consituencies an advantage in elections. The consequences are numerous, including uncompetitive elections and diminished (or unfairly increased) influence of certain voters, all of which can contribute to political gridlock.
Tornoe, Center for Public Integrity