The oxygen leaves as waste. Remember, oxygen is a waste product of photosynthesis . The two atoms of hydrogen are then stripped of their electrons leaving behind their protons as part of the proton gradient inside the thylakoid. OK folks, that's the whole system. Let's go through it one more time step by step starting with the splitting of water.
Water is split into hydrogen and oxygen.
The hydrogen atoms are stripped of their electrons. The oxygen leaves as waste. Electrons are excited and leave the oxidized chlorophyll. The electrons travel down the ETS in the thylakoid membrane, losing energy as they go. Some of the lost energy is used to pump a proton into the proton gradient inside the lumen of the thylakoid.