How can water be electrolysed if it's not ionic compound?
Pure water contains only small amounts of $\ce{H3O+}$ and $\ce{OH-}$ which are generated by autoprotolysis (the reaction given by Klaus Warzecha in his comment to your question). Reduction of $\ce{H3O+}$ at the cathode produces molecular hydrogen. At the anode, water is in turn oxidized, yielding molecular oxygen and $\ce{H3O+}$ (reference).

$$\mathrm{Cathode:}\ \ce{2H3O+ + 2e- \rightarrow H2 +2H2O}$$

$$\mathrm{Anode:}\ \ce{6H2O \rightarrow O2 + 4H3O+ + 4e-}$$

$$\mathrm{Overall\ reaction:}\ \ce{2H2O \rightarrow 2H2 + O2}$$