It cools down the machines by evaporating, and is then released into the atmosphere. That also means the water needs to be clean, pretty much drinking water, because otherwise the evaporation would deposit minerals and stuff.
Turning water into steam uses much more energy than heating water, which means it's a much more effective means of cooling.
What you describe is the type of cooling used in certain power plants. That heats the lake though, which has its own environmental effects https://en.wikipedia.org/wiki/Thermal_pollution
Some smaller data centers have a cool solution where they deposit extra heat into the municipal hot water grid, which is pretty neat https://www.techradar.com/pro/finally-some-good-usage-this-d...