The Sun shines down on to the ocean which evaporates the water.
This water vapour condenses in the atmosphere to form clouds.
When the cloud gets too heavy the burst open and precipitation (a fancy word for rain) comes out.
If the rain lands on a mountain side it forms a stream and flows down hill. This is called Surface Run-off.
Sometimes the water soaks into the soil, this is infiltration. from there it can do two things, it can soak through into the rock layer beneath and flow to a river that way, Groundwater flow. Or it can flow through the soil to the river, that is called throughflow.
Once the water has joined a river it can flow all the way, back out to sea.