Electrolysis is an important method in chemistry where strongly bound molecules are broken apart using a direct electric current. In order for the method to work, the chemicals cannot be in a physical state. For normally solid ionic molecules, such as salt, they must either be dissolved in water or their temperature raised until they are molten themselves. For water, this means it cannot be frozen.
Water, then, is both able to be electrolysed itself, and is a medium for electrolysis. In any case, several eletrodes are inserted into the bath, with positive typically on the side and negative in the center. Alternating current cannot be used, or at least is not efficient because it does not charge the bath continuously as direct current, which is constant and is able to charge the bath like a battery.
hydrogen electrolysis occurs anytime a voltage is applied to water, even when other molecules are dissolved into it. This makes solution electrolysis fairly dangerous, because water is composed of hydrogen and oxygen. These elements are the base reaction for NASA rockets, and amount to one of the most basic and explosive chemical reactions found in nature.
Putting a source of heat, such as a match, near an electrolyzing vat is a little on the absent side. (Which is an euphemism for moronic.) Not in or near, because free oxygen and hydrogen are rising into the air, and is saturated in the water itself, because these molecules are dissolved in the water. The water itself becomes flammable. It is an extraordinary thing to see water burn like kerosene or explode like gasoline, but it is reality when dealing with the electrolysis of water.
For the unwitting, it is a very basic chemical reaction, and can be encountered in many daily situations. Any person working under the hood of a car should be aware of the potential hazards of their direct current battery. There may be no harm, since the gases are under pressure and typically reform water inside the battery without explosion. That said, do not place a utility light on top of the battery. It is a more frequent problem when recharging a battery, and in fact a battery charger is the preferred piece of equipment for electrolysis in the home laboratory.