Short answer: Rekey when the locks are in good shape. Replace when they are worn, damaged, or you want a better lock.
What rekeying is
Inside most locks is a row of small pins that line up when the right key is in. Rekeying swaps those pins for a new set, so a new key works and every old key stops working. The lock itself stays on the door.

| Situation | Usually |
|---|---|
| You just moved in | Rekey. You do not know how many old keys are out there. |
| Lost keys or a roommate moved out | Rekey. |
| Want one key for every door | Rekey, if the locks are the same brand or keyway. |
| Lock is sticky, loose or corroded | Replace. |
| After a break-in with damage | Replace, and check the door frame and strike. |
| Want keypad or smart entry | Replace with the new lock. |