[spoiler]The strategy is the following: the first person to talk has to count the blue hats in front of him. He will say "blue" if the number is even or "red" if the number is odd. He has 50/50 chance of dying, no way to have a higher chance of saving him.
The second one will count the number of blue hats in front of him, if the number is even and the first one said "blue" - meaning "even", he knows he is wearing a red hat (since the number of blue hat did not change) so he just has to say red. If the number he is counting is odd and the first one said "blue", then he is wearing a blue hat (since the number change from even to odd, he must be wearing a blue hat).
Similar reasoning applies in case the first one said "red".
After that, every guy has to keep track of the number or red/blue to be able to call the hat's colour he is wearing.
[/spoiler]
With this strategy, you will save 99 guys for sure and you have a 50/50 chance to save the first guy. This strategy works no matter the number of hats, no matter how many guys in row (as long as you can count them all
).