"How would I calculate the amount of water needed for a given recipe"
You can work this backwards and get in the ballpark for water needed(remember, you'll have H20 losses during the whole process):
5.5 gallons of wort in the fermentor(after fermentation using a racking cane you'll leave a quart to a 1/2 gallon behind)
+ amount of grain in recipe X .12 i.e. absorption
+ evaporation of boil (you can start with ~ 1.25-1.5 gallons per hour)
+ dead space losses depending on your equipment configurations.(you can figure this by using just water and see what's left in the brewing vessels after draining via valves etc.)
Should give you a ballpark of total water needed. It will be up to you to decide how much in mash kettle and sparge. Usually you go with the larger quantity in the mash tun. Anywhere between 1.3 quarts per lb up to 2 quarts per lb once again depending on your recipe and your equipment specs and limitations. Take good notes so you can adjust and "dial in" your system until it becomes "old hat"
That jives with what I do.....
So to work a 10 pounds of grain and 60 minute boil example.....
5.5 + (10*.12) = 5.5 + 1.2 = 6.7 + 1.25 (evap) = 7.95 + .55 (arbitrary loss number) = 8.5 (nice round number)
Now since the infusion has the grain loss I would use 5 gallons for the infusion, and then 3.5 for the sparge.
BUT, all the math aside, the easy way is to take your spoon, or similar and stand it straight up in the brew kettle and add water, one gallon at a time to make a measuring scale. Do a 5 gallon infusion and then you measure and KNOW how much wort you end up with after the infusion. Now, all the absorption is done, as well as system loss. So now you know how much more you need and you make the sparge that large.
If all else fails and you have a little too much, boil a little longer, or, if you are a little short, add some water when you're all done.