A Sim can have up to three whims at once, two are determined by the Sim's traits, aspiration, and current circumstances (such as the presence of a friend or lover), and one is determined by their current emotion and will change when the emotion does. Sims in the fine or asleep emotion will have no emotion-related whim.
Originally, whims not directly related to a Sim's emotions would linger until they were either fulfilled or cancelled by the player by clicking on the small red X on the whim bubble. As of patch 12, whims are automatically refreshed when Sims go sleep,become dazed, or return home from work. However the patch also added a Pin button to pin non-emotional whims.
Satisfying whims gives a Sim satisfaction points, which can be used in the Rewards Store to buy various items and special traits to make the Sim's life easier.