They assign to those factors whatever you can convince them of as an employee/contractor during your interview :)
In case you're fixing an existing problem, the cost of the problem is often roughly known (like in my example). Lost clients due to the specific bug, current clients threatening to leave, sunken/running R&D costs without a solution, missed sales/tenders where clients mentioned the bug as a reason, long term damage to the brand, etc. You might be able to roughly extrapolate that into the future.
In case you're working on a new product or general improvement it can be impossible to measure how much your contribution was worth.
Hence, employees/contractors are usually valued by the hour or by the amount of equity they own and not actually by their value to the company.
In some industries it is possible to be valued exactly by the value you saved. A common example that comes to mind: a lawyer who does pro bono work.
Another example in engineering: filing warranty claims for failing (very expensive) products. You could negotiate to get a percentage of every successful claim. I've heard of people making millions that way in aerospace. Apparently companies in aerospace for whatever reason often don't claim warranty when they're entitled too. Keep in mind that large companies in some industries really really don't care about a couple of deci-millions here and there because their turnover is in the billions and they have "better things to do" :D