I assume that if handlebar tape is grimy, torn, or peeling, it should be replaced. How long should I expect handlebar tape to last before it needs to be replaced? How often do most cyclists replace handlebar tape?
Anywhere from a month or two to years and years; how long handlebar tape lasts depends on too many factors to really answer this with a number. Of course, how often you cycle is a factor, but how good the tape is and how well it's applied also makes a difference.
For example, gel tape is notorious for wearing quickly, as the gel gets pushed away from where you lean your hands. Good-quality cork tape without a lot of padding can be kept around nearly forever, unless you rip it or it starts to stink. Tape that's wrapped way too tightly can develop rips and cracks. And if you have cables routed under your tape, that can subtly move the tape around a little bit as you shift, causing you to need to rewrap or replace more often.
How much weight you put on the bars, how tightly (or loosely) you wind the tape, how good the tape is - all these will change how long it'll take until you have to change the tape or simply rewrap it.
One thing that's worth noting is that if you're wearing through the tape itself, you're probably putting too much weight on your hands or gripping the bars far too tightly. And cork or plastic bar tape that simply comes loose over time can be rewound.
Handlebar tape lasts about 20 years on the typical bike. Of course, the typical bike is ridden 200 miles in the first 5 years and 200 more miles in the next 15.
Handlebar tape succumbs to two main problems:
The first problem may be minor or may be major, depending on how you ride, how you rack/store your bike, etc. The second problem is somewhat more of a constant, but is variable depending on your riding style (more aggressive will generally be more stressful on the tape) and the quality of the tape and the wrapping job.
So basically, you just replace it when it needs replacing, or when you can't stand the look of the stuff.
(Of course, as I've said before, I just use a couple of layers of hockey tape. It is easily installed, durable, works better when wet/sweaty, and can be easily repaired if scraped/torn.)