It's not for protection, it's to form a voltage divider with the photocell.
For a typical photocell, the resistance may vary between say, 5k (light) and 50k (dark)
Note that the actual values may be quite different for your sensor (you'll need to check the datasheet for those)
If we leave the resistor out, the analog input will see 5V either way (assuming an analog input of a high enough impedance not to affect things significantly)
This is because there is nothing to sink the current and drop voltage.
No Resistor
Let's assume the sensor is connected to an opamp with an input resistance of 1 Megaohm (pretty low as opamps go, can be 100's of Megaohms)
When there is no light shining on the photocell and it's resistance is at 50k, we get:
5V * (1Mohm / (1Mohm + 50k)) = ~4.76V
When there is light shining on the photocell and it's resistance is at 5k, we get:
5V * (1Mohm / (1Mohm + 5k)) = ~4.98V
So you can see it's not much use like this - it only swings ~200mV between light/dark. If the opamps input resistance was higher as it often will be, you could be talking a few microvolts.
With Resistor
Now if we add the other resistor to ground it changes things, say we use a 20k resistor. We are assuming any load resistance is high enough (and source resistance low enough) not to make any significant difference so we don't include it in the calculations (if we did it would look like the bottom diagram in Russell's answer)
When there is no light shining on the photocell and it's resistance is at 50k, we get:
5V * (20k / (20k + 50k)) = 1.428V
With there is light shining on the photocell and it's resistance is 5k we get:
5V * (20k / (20k + 5k)) = 4V
So you can hopefully see why the resistor is needed in order to translate the change of resistance into a voltage.
With load resistance included
Just for thoroughness let's say you wanted to include the 1 Megaohm load resistance in the calculations from the last example:
To make the formula easier to see, lets simplify things. The 20k resistor will now be in parallel with the load resistance, so we can combine these both into one effective resistance:
(20k * 1000k) / (20k + 1000k) = ~19.6k
Now we simply replace the 20k in the previous example with this value.
Without light:
5V * (19.6k / (19.6k + 50k)) = 1.408V
With light:
5V * (19.6k / (19.6k + 5k)) = 3.98V
As expected, not much difference, but you can see how these things may need to be accounted for in certain situations (e.g. with a low load resistance - try running the calculation with a load of 10k to see a big difference)