The goal of the Water Works mini-game is to connect all the pipes together to fix the water leaks before time runs out.
You can turn the pipes by tapping on them.
If you run out of time, you can pay diamonds for extra time. Or you can exit the game and try again.