The mechanical ones definitely break more often than the electronic ones. I had a mechanical clicker as a kid and the thing wouldn't stay lined up properly for more than a day or two.
I've had 4 or 5 comps on various bikes, I've tried a few different ones. I have actually never had one fail, I still have all of them. I did have a bracket just die of old age once, so I had to spend $10 on a replacement bracket. That was on a Planet Bike comp after about 8 years of 4 season riding including down to -20*F. The comp is still fine to this day.
Even the crappy Chinese eBay comp that was $4.50 delivered from China never actually failed. It was just a little weird and easy to get confused and accidentally reset the whole comp and lose my odometer settings, so I stopped using it and bought a 2nd Planet Bike comp. I kind of like the cheap little Chinese ones though, mainly because I just kind of think it's funny to get something that does so much for so close to free as makes no difference. I might try another one, there are a dozen pretty common models on eBay.
__________________
Work: the 8 hours that separates bike rides.