It's a rainy day, I'm home unemployed, so here goes!
The odometer (the correct term for the mileage counter) is driven by a linkage that is connected to the 1/10ths mile numbered wheel. That wheel spins the most, and is connected to the next (1 mile) wheel by a reducer arrangement.
What fails (and I'm speaking from 2002 experience here, not having disassembled a coupe speedo, which is harder) is that the 1/10ths wheel is supposed to be fixed to its shaft, but in time starts to slip. If the 1/10ths mile wheel doesn't turn, the 1 mile wheel doesn't turn, and the effect cascades to the 10 mile, 100 mile, 1,000 mile wheel, and so on: odometer no workie.
IIRC the speedo unit ("head" is the preferred term) can be removed, with trouble. Rather than post a possibly inaccurate description of the humbug process, useful directions can be obtained using the forum "Search" function. Once out of the cluster, one has to deform the chrome trim ring to get into the works.
The actual repair (I've done it on a 2002 tii unit) is not demanding and at its heart consists simply of using a ball pein hammer to put a small deformation in the shaft where the 1/10ths wheel rides, so it can't slip on the shaft. Some use a tiny spot of superglue instead; to each his own.
The dirty tricks department comes in when you realize you can take all the little numbered wheels off, reassemble them to read 000000, and have a zero-miles car. It's a hassle to do this and it's is prohibited by federal law. Only licensed individuals are allowed to alter the odometer reading. But I bought my 2002 with a non-working odo, then resold it with one that works, and full disclosure. No harm, no foul, no tomfoolery. If it gave the girl whose dad let her drive it some jollies, good. But she crashed the car, totalled it, some months later, the b*tch.
I confess that my CS odo hasn't been functional since I got my car some 20 years ago. I don't really care although it deprives me of knowing my mpg. Based on the wife's Bavaria, I'd rather not know more than that it's somewhere around 13. I ride my (BMW) motorcycle a lot - it too has a dysfunctional odometer - no surprise given it's from the mid 80s when BMW or their supplier VDO couldn't seem to get it right. Failed odometers were a common fault with the early 3 and 5 series, BTDT.