With any car, there is a small risk you are getting a lemon. If you make it past the initial 4 years of free maintenance and warranty without major (or multiple) issues, then your car is probably not a lemon.
Based on the information I have regarding the older M models that feature the exotic high-revving M-special engines (means excluding fromt he conversation cars like the US E36 M3), the engines last to at least 150k miles. After that, you may or may not be facing a rebuild, depending on multiple factors (how you drove it, how you maintained it, luck, etc.).
The rest of the drivetrain is typically also M-specific, meaning you get different hubs, bearings, driveshafts, differentials, transmissions, etc which are tougher than the rest-of-the-range items, but since many M cars see accelerated wear (track, aggressive driving etc.) I would call it a wash.
And finally, the rest of the car is like any other BMW pretty much. So problems will statistically be based on model, options and usage.
Additionally, I think technologies like DCT/SMG are a little too new for accurate predictions, but personally I seriously doubt their reliability is as good as that of the manual transmissions. Same thing goes for things like the MOST bus, the various computers in the car, sensors etc.
My guess (with old school maintenance) is you should be good to go to about 80-90k without a hitch, then with moderate expenses to 150k (consumables like O2 sensors/cats, seals, window regulators whatever etc.), but after that it's probably a crapshoot.
I think that many modern cars are built with a specific, and limited, service life in mind. Planned obsolescence is the term I believe. It would be bad for business otherwise. Literally, they don't build them like they used to.
2015 F80 ED
2004 Z4 3.0
2014 X1 28i ED