William Mulholland, erstwhile Vehicle Dynamics Engineer for McLaren Inter-Planetary, wrote an interesting introduction to the mathematics of Formula 1 race strategy a few years ago.
In the absence of interference from other cars, the optimal number of stops, and the optimal timing of those stops, can be calculated once the time lost during each pit-stop is added to the time which elapses during each stint of the race.
Obviously, these equations are still highly idealised. The actual lap-time deficit T per lap travelled on a set of tyres will be fuel-load and track-condition dependent, hence in reality this will be a function T(l) rather than a constant.
Moreover, the presence of interference from other cars changes the optimal strategy, and introduces uncertainties. Dropping into slower traffic after a pitstop, and being unable to overtake that traffic, prevents a driver exploiting the full performance potential of the car at that point in time. Hence, the optimal number of pitstops in the presence of other cars tends to be less than the optimal number in the absence of other cars.
The unpredictable behaviour of other cars, and the possible occurrence of chance events such as rain and safety cars, entails the introduction of probability distributions over the optimal number and timing of pitstops. Calculating these optima in the presence of other cars becomes an exercise in game theory, where the effect of a decision is influenced by the decisions of other agents, and where the decision of an agent is influenced by that agent's beliefs about the anticipated decisions of the other agents.
Bayesian networks are precisely designed to capture the conditional probabilistic relationships between numerous chance events and unpredictable decisions. Hence Bayesian networks might be very useful for updating the most likely optimal strategy as a race progresses in real-time.