Going off this question, what happens to the fuel lines to the engine when it falls off? Does it automatically shut off or do the pilots have to manually do it?
Engine separation won't cause automatic closure of valves, but the resulting low pressure will illuminate lights (including the Master Caution light) on the panels and display messages on the displays.
The pilots will have to react to the engine separation, the same way than for an engine fire or severe malfunction. This non normal procedure includes shutting down the fuel line by setting the engine start lever to CUTOFF or triggering the fire bottles on the affected engine.
There is a spar fuel valve (or fuel shutoff valve) fixed to the wing and to the fuel tank, which stays on the wing in case of separation. This valve is to prevent leaks due to a broken line. As the hydraulic power may be missing after the engine damage or separation, the valve is controlled by an electric motor with a backup battery and a double wiring redundancy.
Example on the the B737 NG:
(Shut-off valves framed in purple, source)
Non-Normal checklist used:
ENGINE FIRE or Engine Severe Damage or Separation (NNC 8.2 of the Quick Reference Handbook).
(Click to enlarge, source)
I'm not aware of any automatic fuel shutoff valve in case of engine seperation. The pilot has to manually close the fuel shutoff valve to prevent fuel loss. From b737.org:
Engine separation is an extremely rare event. ... It is important to use the fire handle to close the spar valve and prevent a massive overboard fuel leak; refer to the airplane flight or operations manual for specific procedures.
Also, see here.