Can water be produced by mixing hydrogen gas and oxygen? Could there be some kind of process, a kind of "retrograde electrolysis" where hydrogen gas (or in some other form) and oxygen gas (or in some there form) are mixed with required energy to combine to form water as a byproduct?
Indeed, it's called combustion! When you burn hydrogen and oxygen gas, the reaction is:

$$\ce{2H2_{(g)} + O2_{(g)} -&gt; 2H2O_{(g)} + energy}$$

Basically, you could see the former U.S. space shuttle as a large machine that turns hydrogen and oxygen into water. (Note: the space shuttle used liquid hydrogen and oxygen, but otherwise the principle and formula is exactly the same)

Since the Gibbs free energy of the forward reaction is negative ($-242\textrm{ kJ/mol}$), you don't need to add energy to the system, the reaction is spontaneous (mind you, you generally need a spark to ignite the combustion because there's a kinetic barrier to the reaction called the energy of activation).

The reverse reaction, water to hydrogen and oxygen, has a positive Gibbs free energy, so you need to add energy in the form of electricity to the system to make the reaction happen.