get yourself a "carfax" account. (not sure if applicable in your part of the world) but I'm sure there's similar systems to track mileage. If that's not an option here's a few things to look for:
a) maintenance records - the more complete the better (including receipts)
b) compare mileage to wear on components - tires, exhaust, brakes - simple items to check wear - on pedals, carpet, under hood and in trunk
c) look for leaks - any liquid, exhaust
d) check ALL the electronic functions - windows, wipers, heat/AC, lights and make sure there are no "system warning lights - on" dashboard.
e) drive it at different speeds - listen for grinding, vibrations, (including while braking)
Finding a good BMW is not difficult, but can be time consuming - many just don't get needed or recommended maintenance and that's where it can get expensive - catching up.