When would it be best to add the sugar: after you finish boiling the water or after you've added ice?
This question seems like one that is with reference to a culinary dish that has to be prepared, like iced tea, that requires water to be boiled to create it followed by the addition of ice to cool it.
The solubility of sugar in water shows a wide range with changing temperature. At 100 degrees Celsius sucrose is almost three times more soluble in water than it is at 20 degrees Celsius.
If your intention is to dissolve more sugar in the dish to make it sweeter, it would be better to dissolve it when the water has just been boiled. The solubility of sugar is the highest here. After the addition of ice, the solubility decreases and it would be difficult to dissolve sugar to achieve the required sweetness.