The BMW 525i has an electric fuel pump. The pump is located in the fuel tank and relies on an electrical relay to send electrical power from the battery to the pump. A faulty relay can have the same symptoms as a bad fuel pump. The best way to determine whether the problem is with your relay or your pump is to locate the relay and test it.
Ensure that the car is turned off. Open the bonnet for access to the engine compartment.
Locate a black box mounted to the passenger side fender. The box will have bolts keeping a cover secured to it.
Unscrew the bolts with a socket wrench. Lift the cover off and place it aside. The fuel pump relay will be labelled by the diagram in the fuse panel. Follow the diagram to locate the relay.