After a Cleric, Paladin, Ranger, or Wizard rests, they must choose spells to prepare. These spells can then be cast until the Cleric, Paladin, Ranger, or Wizard rests again, as long as you still have spell points. Each time you rest, you have another chance to change your prepared spells. Bards, Favored Souls, and Sorcerers can always cast all the spells they've memorized without need for preparation.
See also Spell memorization, as it often gets confused with.