After initializing the timer, it decreases only if a player is in range. Once the timer reaches zero, the game tries to spawn the configured entities (usually mobs). The timer is paused if all players leave the activation radius of the spawner and is resumed if the spawner is activated again. The timer is reset (re-initialized with a new random number) only after a successful spawning. If spawning conditions are not met (e.g. because the spawner area is well lit), the timer will pause at zero. Then the spawner will try to spawn entities each game tick until it succeeds (e.g. if a critical torch is removed, mobs spawn instantly).
Here is the relevant algorithm (executed each game tick):
if there are players in the activation range then
if spawnTimeCounter > 0 then
decrease spawnTimeCounter
else if spawnTimeCounter = 0
try to spawn entities
if spawned at least one entity then
initialize spawnTimeCounter with a new random value
else if nothing spawned - do nothing
else if no player in the activation range - do nothing
source: MCP 7.5.1 MobSpawnerBaseLogic.java, Minecraft 1.5.2.