If a modern commercial airplane such as a Boeing 787 would stall with only one functioning engine, is it possible for the pilots to right it or would it require two functioning engines?
Yes, but the challenge is managing the asymmetric thrust effects when applying power during the stall recovery.
Pilots are trained in the sim for two stall (actually, just stick shaker onset) situations: high altitude and low altitude. Low altitude stall recovery training is normally done by slowing until the stick shaker starts, then adding max thrust while lowering the pitch attitude moderately, only enough to keep the speed just above stick shaker onset.
The objective is to minimize altitude loss while accelerating. The training doesn't actually get the airplane to a full aerodynamic stall; pilots are trained to start the recovery as soon as the shaker goes, which is still a few degrees below the actual stall AOA (as a rule, only production or experimental test pilots will take airplanes past stick shaker right into the natural stall, or stick pusher activation if equipped with one).
I don't believe anybody actually trains for stall recovery while single engine (I never did when training on the CRJs). In any case, if you had to deal with that, you just have the added complication of managing the yawing motions caused by the asymmetric thrust, and the much more sluggish acceleration, so in addition to managing pitch, you are pretty busy with your feet to keep the airplane straight, and you would have more altitude loss.
At high altitude, it's similar, except that the recovery maneuver is much more aggressive in the thin air. With little to no reserve power, you pretty much have to dive to gain speed, and you cover a lot more distance through space to get the same indicated airspeed rise than at low altitude, so the indicated speed increase is slower.
So you pitch over a lot more, with no effort to minimize altitude loss and you let the airplane dive and wait for the speed to come up. If you were single engine (you would be descending anyway to single engine ceiling if you were) you would be doing the same sort of fancy footwork to allow for the asymmetric thrust and keep the plane straight, to the extent that you have thrust to work with to help accelerate.
So you could say a single engine stall is perfectly recoverable, but the extra workload increases the chance of secondary problems from mishandling (like secondary stall).
A stall recovery doesn't require engines (although they help, especially if altitude is an issue). To recover from a stall, you need to lower the angle of attack. You can do this by lowering the nose until airspeed picks up, no engines required provided you have altitude to spare.
With enough height, any aircraft can recover from a stall without any engine power required. In fact, for under-wing engined aircraft like the 787, it is sometimes necessary to reduce the thrust, because of the pitch-up tendency this engine placement provides.
The technique in a stall recovery is always, always to reduce the angle of attack, which is easiest done by reducing the pitch attitude of the nose.
Recovery with one operative engine is possible, requiring a reduced angle of attack to break the stall, then accelerating, and adding power in proportion to the increasing rudder authority. A slight bank toward the side with the operative engine would help, but only enough to null sideslip (center the ball) as thrust is increased.
Gradually accelerate and increase thrust. Until the plane is able to climb up and away from terrain. We're talking about seriously delicate flying. Milk that mouse, bruhs.
Such a situation would result in a huge altitude loss, but that is what it would take to accelerate without much engine thrust.
Pilot flying: DO NOT YAW THE PLANE WHILE IN THE STALL
Pilot flying: BEWARE OF VMC-ROLLING THE PLANE WITH TOO MUCH THRUST FOR THE AIRSPEED