Since there is no specific amount given, lets take the total liquid in the cask to be 1. Then the amount of water in the cask is 1/4 and the amount of wine is 3/4. Suppose you take out amount x (x< 1). The amount of water in that is x/4 and the amount of wine is 3x/4. That will leave 1- x/4 water and 1- 3x/4 wine. You want to add an amount of water to make this equal parts wine and water.
Since we "substitute" that by water, we simply replace the amount taken out, so that we are adding x water, then we will have 1- x/4+ x= 1+ 3x/4 water and 1- 3x/4 wine. To have equal amounts of water and wine, those must be equal: 1+3x/4= 1- 3x/4. Solve that for x.