How the fuel in the wings is managed in case of an engine failure?
That’s a pretty broad topic and depends on the aircraft in question and the fuel systems which it uses.

Large airplanes like jetliners have complex fuel management systems which feed fuel from the main tanks into feeder tanks which the engines can “drink” from.  The process is automated in modern aircraft - around the same time that the Flight Engineer went the way of the dinosaur - so little, if any, input from the crew is required in the process.

On smaller twins, say, for example, a Cessna 310, fuel is provided to the engines via a dedicated main fuel tank and optional aux tanks for each engine.  In the event of an engine failure, the pilot can select the ability to cross feed the good engine on the fuel system for the bad engine in order to prevent a fuel imbalance.