Perpetual Hydro energy loop

how do hydro electric power plants work? I must be totally wrong in my idea of how they work? Are they connected to the grid and then making electricity? which would be stupid unless they are producing more then they consume?

physics is not really my thing..sorry if i seem irrational