A salt like $\ce{Na2SO4}$ is essential in electrolysis. It provides ions $\ce{Na+}$ and $\ce{SO4^{2-}}$ which are attracted by the electrodes in the solution and migrate to them. When they arrive near the electrodes, they are not discharged. But they neutralize the charges of the ions that are produced out of water being destroyed at these electrodes. Let's see what's going on at each electrode.
At the cathode (negative pole), water is decomposed according to : $\ce{2 H2O + 2 e- -> H2 + 2 OH-}$. This is only possible if there are some positive ions available near the cathode to compensate the negative charges appearing in the solution with these newly created $\ce{OH-}$ ions. Without positive ions like $\ce{Na+}$ near the cathode, these new $\ce{OH-}$ ions would repel further electrons coming from the outer circuit and prevent them from arriving to the electrode and from reacting with water. This would stop the electrolysis.
At the anode (positive pole), water is decomposed according to : $\ce{4 H2O -> O2 + 4 H+ + 4 e-}$. This is only possible if there are negative ions arriving near the anode to compensate the positive charges appearing in solution because of these newly created $\ce{H+}$ ions. Without negative ions like $\ce{SO4^{2-}}$ in the solution near the anode, these new $\ce{H+}$ ions would make a positively charged solution. This would prevent further electrons to be ejected from water. This would stop the electrolysis.
At the end, the composition of the solution is modified around the electrodes. Near the cathode, the solution contains more and more $\ce{NaOH}$. Near the anode, the solution contains more and more $\ce{H2SO_{4}}$ Of ourse if you stir and mix anodic and cathodic solutions, the acid and the base neutralize each other, which regenerate the solution of the original salt.