DPR is useful as a comparison tool rather than an exact mathematical expectation.
A set of baseline assumptions can be made. There will be variation from these due to luck or unusual circumstances in real play, but variation should average out. More to the point, as long as those same assumptions are used in all examples, a comparison of baseline performance can be made.
Even if the exact values are out by a bit, the baseline performance of multiple examples should be directly comparable since they are all running off the same assumptions.
More to the point, DPR can be calculated. There is no way that you can accurately gauge the effectiveness of using an invisibility spell, but you can calculate the DPR of that spell slot if used to cast scorching ray.
This is also why DPR only sets a baseline: unless you're a martial character, using your resources to deal damage is often not the best option, but it is an option that can be calculated and compared. So it forms a baseline of your performance, even though the actual performance is likely to be considerably better if better options than damage exist.
So if character A is calculated to have a DPR of 5, and characters B and C have a DPR of 10, they might not actually put out that exact damage every round, but you know that A is doing about half the damage of the other two, whatever that ends up being. Also, if character B is better at control , and damage dealing is only their tertiary function, whereas it is character C's prime focus, you know that the actual performance of character B will be considerably better than C, despite them having similar DPRs.