Not exactly your model, but it should follow the same format. It should make sense when you actually see the configuration of the lines. On the e36, you don't have to remove any braquets, not sure about the e39 of yours.
http://m3.madrussian.net/diy_front_brake_lines.shtml
http://m3.madrussian.net/diy_rear_brake_lines.shtml
I did not take any special precautions before changing the lines. I just let all the fluid drain out thru the lines and then put in all new lines and bled the system from there. I haven't noticed any bubbles yet.
Take the calipers off, disconnect them from the lines, replace pads, reconnect new lines, put calipers back on. After all 4, flush the system. You want to start from the farthest line and go to the closest line (RR, RL, FR, FL) I believe.