system
Given the following post, respond as if you're commenting on Reddit:
human
How are dams able to be constructed against the constant push of flowing water?

Secondly, how exactly does a dam hold back a constantly accumulating amount of water without simply overflowing? I know they drain some water through spillways, but it seems like the vast majority of water is still trapped above the dam. Where does it all go?
gpt
Usually the river is redirected around the site where permanent dam construction is taking place. A temporary dam may be used to assist the redirection.

A hydroelectric dam routes some of the water through the turbines within the dam to create electricity. Excess water exits through spillways.

When the lake upstream of the dam has reached the target level, the dam engineers allow water to flow downstream, else the damn would overflow. So at some point in time, the water exiting through spillways (and turbines) is equal in volumetric flow rate to the amount of water entering the lake that has formed above the dam.