here's the gnome's plan, if anyone is still confused:
label the gnome in the back 100, and the gnome at the front 1.
gnome 100 sees 99 hats. everyone is told beforehand that if he sees an odd number of black hats, he should say 'black.' if he sees an even number of black hats, he should say 'white.'
gnome 99 hears gnome 100 shout 'black' and understands that there are an odd number of black hats in the 99 gnomes, including him. if gnome 99 sees an odd number of black hats, he must not have a black hat on his head (because this would contradict the information given to him by gnome 100). if gnome 99 sees an even number of black hats, he must have a black hat on his head. gnome 99 is safe!
gnome 98 will have heard gnome 100 shout out the even/odd scheme, and so gnome 98 can subtract the color of gnome 99 to infer his/her own color.
every gnome will know what color hat he or she is wearing by keeping track of whether or not the number of black hats including them should be even or odd, based on what the gnome behind him/her said.