This is not fully understood, but we may be able to form a mental picture of what is believed to happen as follows.
The in-electrode is surrounded by a vast assemblage of these tiny molecules, most of them those of water, but a few those of the acid. The latter are more complex in their structure than the former, but they too contain hydrogen. Current flows into the electrode and instantly hydrogen atoms from the acid molecules crowd round it, like boatmen at the seaside anxious to secure a passenger. Each takes on board a quantity of electricity and with it darts across the intervening space to the other electrode. Arrived there, it gives up its load and, its work done, remains lying upon the electrode until enough others like unto itself have gathered there to form a bubble and so escape. These hydrogen atoms are thought to be the craft which carry the current through the liquid and enable it to pose, as it were, as a conductor of electricity, which in reality it is not.
But where does the oxygen come from?
To find the answer to that we must add a second chapter to our story. When the hydrogen "boats" took on board their load of electricity they left their former associates, and these forthwith "set upon" neighbouring water molecules and with the audacity of highwaymen stole from them enough hydrogen atoms to take the place of those they had lost. Thus the acid molecules became complete once more, while the scene of the conflict near the in-electrode was strewn with the remains of the water molecules from which the hydrogen atoms had been stolen. These remains, of course, would be oxygen, and they, collecting together on the electrode, would eventually be in numbers sufficient to form bubbles and so escape.
Thus it may be the acid which really does the work, yet because of its subsequent raid upon the water it is the latter which disappears, and it is the materials of the latter which are bought to the surface in the bubbles.
And there we see the mechanism whereby, so it is believed, electric current can pass through otherwise non-conducting liquids. And the important point, as far as practical utility is concerned, is that the passage of the current is accompanied by a splitting up of something or other, either the water or something in it, the materials of which are deposited, one on one electrode and the other on the other.
And now we can proceed to those useful applications of electrolysis, the commonest of which, perhaps, is electro-plating.
We have seen how electrolysis causes hydrogen, probably out of the acid, to be deposited upon one electrode. Suppose that, instead of an acid, we put in the water one of those substances known to chemists as a "salt," the commonest example of which is ordinary table salt. This well-known condiment is caused by the interaction of hydrochloric acid and the metal sodium and will serve to illustrate what all salts are.
All acids are compounds of hydrogen and something else, and their biting action is due to the readiness with which the "something else" evicts the hydrogen and takes in a metal in its place. Thus hydrochloric acid, given the opportunity, gets rid of its hydrogen and takes in sodium, thereby forming chloride of soda or common salt.
Another example is the gold chloride familiar to photographers. This is the result of the action of certain acids upon gold, wherein the acids throw out their hydrogen and take in gold instead.