Like all cars, it comes down to how they are maintained, or not. The E39 is a well regarded platform, but check the service history, number of previous owners, how long this owner has had it for, all the normal stuff you should do before you buy a used car.
You are doing the right thing though, educate yourself about the car you are looking to buy and don't rush into buying the first car you see.
There are plenty of members that are more familiar with this model than I, so expect others to offer up their thoughts as well.
Riding in style