Lawyer here. I’ve skimmed the decision, and here’s what happened.
The main reason this case was overturned was because in 2005 the Montgomery County District Attorney effectively promised never to prosecute Cosby for raping Andrea Costand, believing that there was no way he could get a conviction, and seeking to give her some justice by helping her when she sued him for the assault in civil court. Because the DA had said they were not going to prosecute him, Cosby was unable to “plead the 5th” in the civil lawsuit and was forced to admit under oath at depositions to giving multiple women Quaaludes before sex, and even said he gave Costand multiple Benadryl before he assaulted her.
Years later, a new Montgomery County DA said that the DA in 2005 hadn’t formally bound the state, and therefore she could go forward with prosecuting him. At the trial, Cosby’s lawyers argued that he couldn’t be prosecuted because of what the DA did in 2005, but the judge said that earlier decision was not enforceable and allowed Cosby to be prosecuted.
Today the Pennsylvania Supreme Court disagreed (link to decision is here), saying that:
For the reasons detailed below, we hold that, when a prosecutor makes an unconditional promise of non-prosecution, and when the defendant relies upon that guarantee to the detriment of his constitutional right not to testify, the principle of fundamental fairness that undergirds due process of law in our criminal justice system demands that the promise be enforced.
In other words, the DA in 2005 promised not to prosecute Cosby for raping Costand (in an effort to allow her to sue him civilly), that must be enforced, and therefore Cosby goes free.
There are other aspects to the decision, but that’s the big one.