When people sprinkle water on hot and dry roof on a sunny day, that water evaporates by taking energy from the ground, roof and surroundings. Since water contains high latent heat of vaporization therefore it absorbs more heat from the surrounding before the water gets converted to vapors leading to evaporation and thus cools down the overall surrounding area.
The evaporation of water causes a cooling effect because the large latent heat of vaporization of water helps to cool the hot surface.