The exited electrons release energy as they move down the electron transport chain
This energy is used to transport protons into the thylakoid space from the stroma, so that the inside has a higher concentration of protons than the stroma. This forms a proton gradient across membranes.
Protons move down their concentration gradient into the stroma via ATP synthase. The energy from this movement combines ADP and Pi to form ATP
Chemiosmosis is the name of the process where the movement of H+ ions across a membrane makes ATP.