One aspect of this question hasn't been addressed by other answers: service intervals.
If you drive a car, you know to lube it every 3000 miles, rotate tires every 7500 miles, flush the fluids every 30000 miles. ... Most components would have reasonably well-defined span they will serve, and would probably start falling apart after this many miles, even with reasonable maintenance and repair. What would the range in time and/or miles be for commuter bikes? road bikes? mountain bikes?
A probable reason for this oversight is that, with respect to the OP, most bike components do not have defined service intervals, at least in terms of mileage. For that matter, I don't know the empirical basis behind automotive service intervals, but I guess I'd have to assume that at least some of them (e.g. replacement belts) are based on some sort of statistical analysis of mean time to failure.
Chains
Chains have the most clearly defined replacement interval, and it's not defined in terms of mileage. It's defined in terms of the amount worn, related to the length a chain has stretched due to wear. A more technical discussion is here at this Cyclingtips article, but 11s and higher chains are replaced when they hit 0.5% wear (i.e. measured length over 0.5% longer than original), and 10s and earlier chains can be replaced at 0.75%. You can replace chains later than this, but you are increasingly likely to wear out the cassette, and if you replace a chain much too late you could also kill the chainrings.
Bikes don't have built-in odometers like cars. Even if they did, the distance before you hit the wear limit will vary considerably due to variations in how often and how thoroughly you clean your chain, the conditions you ride in, the quality of lubricant used, and other factors. Further, most end users likely don't log their chain life. This requires manual effort. Platforms like Strava offer some partly automated ability to do this, but the last time I changed my chain I forgot to note it on Strava, and now I don't have an exact date where I put its replacement into service.
Related to the chain, one rule of thumb I've heard is that if you replace chains at or before the wear limits above, you can get 2-3 chains per cassette, and 2-3 cassettes per chainring. For cassettes, I think they are typically replaced when a new chain skips on the cogs; there are visual guides to detecting worn cogs but I suspect you'll get skipping before visible wear. One discussion of that is at this answer.
Tires, rim brake rims, brake pads
Some tires have wear indicators, which are little dots molded into the tire. Once these become invisible, you would be recommended to replace the tire. Some discussion is here. However, in principle, you could also keep riding the tire until the tread is completely worn away in some spots and you can see the carcass or the puncture belt - that would be a bit extreme, but I suppose you could do it.
For rim brakes, some rims have similar wear indicators. Otherwise, you would check if the brake track is concave - an illustration is here. For disc brake rims, because they don't wear in the same fashion, I don't know that there is a replacement guide, and I think you can keep riding them until the rim starts to crack at the spoke holes. I'm not an engineer, but I assume that eventually the rim material will fatigue enough for that to happen. I don't know what sort of mileage you could expect that to happen at, but it could be very high.
For rim brake pads, there are typically wear lines molded into the pads. Disc brake pads and rotors have manufacturer specified thicknesses that you measure with calipers.
Bearings
To my knowledge, you would typically check bearings for a gritty feeling, as discussed in the terminology index and as mentioned in this answer. If they're cup and cone bearings, you'd want to re-grease them periodically (e.g. annually, consider more if you're riding a lot in wet conditions). Also specific to this type of bearing, the balls and the cones can be replaced when worn. Cartridge bearings are typically designed not to be serviced and to be extracted and replaced when they're worn; again, you'd check this by turning the wheel or crank by hand and feeling how smoothly the bearing turns.
Cables
The performance of shift and brake cables and their housing degrades over time as contamination gets in and the cables stretch. Again, there is no specific recommendation for service intervals. I've heard active cyclists say they replace annually. I know I've been able to stretch my service intervals longer than that with acceptable performance. Others may have different experiences, but this may be one of the most under-appreciated parts about owning a bike.
Higher-end groupsets are switching to electronic versions. These are actuated by a wired or wireless signal, and a motor moves the derailleur. In principle, the average (or median, or whateverth percentile) number of cycles to failure of the motor could be determined in a test setting. The issue would be tracking the number of cycles the motor has cycled through. To my knowledge, SRAM's AXS app tracks the number of shifts and a few other statistics, so in principle it could warn users if the motor hits some sort of lifespan benchmark. It does not do this yet, and I don't believe SRAM have publicly commented on the expected motor lifetime in terms of shift cycles. I am pretty sure that the Shimano Di2 and Campagnolo EPS groupsets and apps don't track this info, although in principle they could.
Frame and fork
Most forks on decent-quality bikes are made of carbon. Higher-end frames are also often made of carbon. Lennard Zinn at Velonews asked fork manufacturers about the potential lifespan of carbon forks. The consensus was that manufacturers weren't concerned that the forks would fail due to fatigue alone - keep in mind that I'm using the term in a lay sense; this answer discussed that fatigue in the engineering/physics sense applies to metals and not to carbon. The manufacturers said that their forks were able to exceed industry-required tests, and that they performed better than metal forks. The same, to my knowledge, is true of carbon frames.
The real issue is that bicycles take all sorts of little knocks over their lifespan, e.g. you lean your bike against the car, and later you open the car door and the bicycle tips over (happened to me), or similar happens at a coffee stop, etc. Not all similar impacts will cause carbon to fail. However, it is possible that minor impacts like these can precipitate an eventual failure, and the damage isn't obvious at first glance. Because of the random nature of such events, I don't believe that there can be a defined service life for frames and forks. You would be better off visually inspecting for cracks at some intervals, e.g. when you take your frame in for annual service. You can also monitor for changes in how the bike feels, e.g. something feels loose or soft. This does depend, however, on your ability to perceive subtle changes.
As mentioned in a comment on another answer, carbon is surprisingly repairable. In fact, it may be more easily repaired than metal bikes - you often need to replace a tube wholesale, but carbon repairs can be localized to just the affected area.