If the government builds a bridge, how do we know it's the best possible usage of real resources (i.e. steel, labor, etc) at the time? I would assume the &quot;goal&quot; of any economic activity is to make the largest amount of people the &quot;happiest&quot; -- i.e. Pareto Efficiency or sum-total 'utility.'
How do we know if this occurs? Either before, during, or after construction?
A short answer is that in case of provision of public goods in real-life we can never be completely sure if they are provided in optimal quantity due sheer difficulty of quantifying all costs and benefits, measurement problems when it comes to underlaying utility, due to uncertainties involved and many other factors.
However, this does not mean that no evaluation of public projects can be done. Most developed countries will have some dedicated analytic unit. In the Netherlands where I live that would be Centraal Planbureau [Bureau for Economic Policy Analysis] (CPB)  in the US it is Congressional Budget Office (CBO).
These units routinely engage in cost-benefit analyses of public projects and then make recommendations based on whether the projects net present value is positive. The net present value would be given as:
$$ NPV = B_0 - C_0 + \frac{B_1-C_1}{1+r} + \frac{B_2-C_2}{(1+r)^2} + ... + \frac{B_T-C_T}{(1+r)^T} $$
Where $B$ are benefits of the project, $C$ are costs and $r$ is discount rate or you can interpret it as a required rate of return.
The benefits and cost try to capture actually underlaying changes in utility. They will be usually estimated using hedonic pricing or various discrete choice models that can tell us something about peoples preferences and utilities based on observing their actions. For example, from the way how housing prices vary in cities with high congestion we can estimate how much people value time lost in traffic. The required discount rate is usually set to be equal to interest rate on government/municipality bonds or rate that government could obtain if it had invested the money into wealth fund. Of course, the way how these parameters are estimated or assumed is always a point of contention as this can't be done with infinite precision and complete certainty (this holds even in cases when we do ex-post cost-benefit analysis as most benefits and costs are virtually never directly observable and have to be estimated).
The above is, of course, just a short overview as providing an exhaustive review of how public cost benefit analysis is done is unfortunately beyond scope of SE. A good and highly cited example of public cost-benefit analysis is: Leape, J. (2006). The London congestion charge. Journal of Economic Perspectives, 20(4), 157-176.
Furthermore, just because project passes cost-benefit analysis it does not necessary means that the outcome is pareto efficient or even that it maximizes utility. However, it is reasonably good guard against completely frivolous spending.  This being said, advice given is not advice taken and such analyses are often ignored by politicians, as pointed out by Giskard public officials are not necessarily benevolent.