Why would a glider have water ballast? If it is trying to stay aloft without an engine, wouldn't it be better to be as light as possible?
Mass doesn't affect the maximum distance, only the maximum endurance.

For example, image two identical planes A and B: A weights 50kg less than B. Assuming no wind (horizontal / vertical) and speed of best glide, both gliders will land at the exact same spot.

The lighter airplane A however will arrive later than B, as the speed of best glide is less than for B. In conclusion you can say, that additional mass only increases cruise speed, but not the travel distance.

Glider competitions are most of the time a route you have to fly in the shortest time possible. So that means, if you have a higher speed of best glide, you can fly faster in competitions.

The only downside to having a higher weight is, that your liftrate in thermals will be decreased and due to the higher speed it is harder to center the thermals.

It is to some extend also possible to shift the Centre of Gravity (CG) with the added load. The further it is to the aft limit, the higher your maximum distance is. This is because you will have less down-force from the stabilizer required. (If the CG is at the front limit, you will need to pull the control stick in order to fly level, therefore you have more drag). However I think this is rather a positive side effect and most of the time the water is used for flying faster. 

Source: I am a glider pilot and currently doing my ATPL training.