Short answer
Most households should have carpets professionally cleaned every 12 to 18 months. Homes with pets, children, smokers or heavy foot traffic should go every 6 to 12 months. Carpet manufacturers commonly require professional cleaning every 12 to 24 months to keep a warranty valid.
The general rule
For an average household with no pets and moderate traffic, once every 12 to 18 months is the right interval. That is often enough to remove the soil that vacuuming leaves behind, and not so often that you are spending money on carpet that does not need it yet.
When you should go more often
Cut the interval to somewhere between 6 and 12 months if any of these apply to your home: you have pets, you have young children, anyone smokes indoors, you have allergy sufferers in the house, or you have light colored carpet in an entryway or hallway. Each of those puts soil into the carpet faster than a normal household does.
The warranty reason most people miss
Most carpet manufacturer warranties require documented professional hot water extraction on a set schedule, commonly every 12 to 24 months. If you ever need to make a warranty claim and cannot show that the carpet was cleaned, the claim can be denied. Keep your receipts.
Why waiting costs more
Soil in carpet is abrasive. Every step grinds it against the fibers and cuts them, which is what produces that permanently dull, matted look in traffic lanes. That damage is mechanical and it does not come out with cleaning.
Cleaning on schedule is cheaper than replacing carpet early.
What about vacuuming?
Vacuuming and professional cleaning do different jobs. Vacuuming removes loose surface soil and should happen weekly, or more in traffic areas. It does not remove the oily residue that binds fine soil to the fiber, and that residue is what professional hot water extraction is for.
One is not a substitute for the other.