Water comes from the ground by use of water wells which are dug or drilled into the ground until water is reached.
In some locations wells can be dug to reach water when the water table is at a shallow depth and in other places a well will need to be dug deep or drilled deep into rock to reach water underground.
The wells access the ground water which flows through sand, rock, gravel, dirt etc through the ground.
Then a pump which is usually a submersible pump in deep water wells pushes and pumps water to the surface and into homes, business etc.
Shallower wells may use a jet pump that uses suction to lift the water to the surface and some hand dug wells use buckets to get the water.
The water that is in the ground comes from rain and when it rains the rain seeps into the ground and eventually reaches the water table.
The depth of the water table can be a few feet below ground or 50 feet and sometimes deeper.
In my location I can dig down to 2 to 4 feet and water comes pouring in the ground which is where the water table is.
I still have to dig or drill deeper for cleaner water but I can access some water at 2 to 4 feet.
I have a water well on my property that is around 150 feet and will likely never run out of water due to the high water table around here.
My well uses a submersible pump which is in the well and pushes the water up to the surface.
The water in the well is likely thousands of years old and flows in from all around and can even come from miles away from the well.