As I understand it, in order to keep the lunar module ascent engine simple, instead of fuel and oxidant pumps, tanks of helium at pressure were used. This pressure was used to force the fuel and oxidant through the pipes to the engine, where they would meet and, being hypergolic, spontaneously ignite and produce thrust. What I cannot understand is how the engineers ensured that only fuel reached the engine and not a mixture of the gas and the fuel; in other words, how did they prevent the helium bubbling through the fuel and a fuel/helium mixture or even just helium reaching the engine. Having to work in space it could not rely on gravity to help.
The ascent engine was normally fired when the LM was sitting on the moon's surface, so the tankage was subjected to about 1/6 $g$, more than sufficient to separate the dense liquid fuel from the helium pressurant. Once the engine was ignited, its own thrust accelerating the spacecraft would maintain the ullage.
The same question could well be asked of the LM's descent engine and the main engine on the Apollo service module, however, which did both need to fire in free-fall. In those cases, the smaller RCS thrusters on the LM or CSM were fired first, to "settle" the tankage and separate the fuel from the helium. In the LM case, this "ullage burn" was about 7.5 seconds. The first couple of service module burns -- typically for mid-course correction while en route to the moon -- generally didn't need an ullage burn prior, as the tanks would be full of propellant with little or no volume of helium. SPS burns later in the mission did require ullage burns. The RCS thrusters produced about 100 lbs of thrust each, and four would be used for the ullage burn, yielding roughly 1/200 $g$ acceleration.
The same RCS ullage burn technique would also apply to a situation where the descent engine failed and the ascent engine needed to be used for abort from free-fall, or in flight testing of the ascent engine.
That, in turn, raises the question of how helium ingestion was avoided in the RCS thrusters, since they were also helium pressurized. In those cases, the helium was separated from the propellants by a teflon bladder, so the helium didn't mix with the propellants. This was more practical to do on the smaller scale of the RCS propellant tanks than it would have been for the larger engines.