The problem is dealt with by
changes of venue. It's a matter of media markets. What is "front page news" in one market (where the crime is committed) is more than likely page ten in another (if it's even reported). In the example I gave in my earlier post, Bakersfield is a completely different market than San Francisco. In fact, I'd hazard there are at least three separate markets between the two cities.
The other method is in jury selection. Many years ago I was an alternate juror for a fairly notorious murder trial. The selection process began with the random selection of 50 names from the jury pool. Then each side - prosecution/defense - had the same number of challenges with cause, by which a potential juror could be dismissed for a stated reason. Each also had the same number of challenges without cause, by which dismissal could be made without stating a cause.
By this means, each side can work to assure that an impartial jury is seated. Of course, each side will try to ensure that jurors favorable to their case will be chosen. I'm sure that law schools have courses on jury selection. I see the process as similar to my way to divide a desired treat between two - one cuts, the other gets first choice, so the cutter is motivated to divide equally.
My name was drawn 50th (I assume, as it was last announced) and I was 2nd of 2 alternates, which infers that each side had exercised all of its challenges. I'm sure there are trials for which a 2nd 50 would need to be drawn, or after failing to seat a full jury, a change of venue would be made.