It is possible for only the back prisoner to die, no matter how many prisoners there are, and him only 50% of the time. The back one computes the “parity” of all the hats in front of him, and he says one color if there are an even number of hats of a certain color, else the opposite. {For example, he says "black" if there are an even number of black hats, else "red".} He might have that color hat, and live, or the opposite color, and die; no way for him to know. But now the second guy sees all the hats in front of him, so he can figure out his color using the “parity” given to him by the back guy. {For example if he sees an even number of black hats, and the back guy said "black", then his hat is red.} So #2 says his color and lives. The third prisoner hears what second one said, and sees all the hats in front of him, so he can figure out his color using the “parity” from the first guy. {For example if he sees an even number of black hats, and #2 said "black", and the back guy said "black", then his hat must be black also.} So #3 says his color and lives. And so on... Each prisoner can figure out his color from what the ones behind said and what he can see of the ones in front of him, plus the back guy's parity bit.
Pretty cool, eh?