They just have to be accurate enough on average with room for error. If they fire 90 unproductive workers and accidentally 10 productive ones, it could still be a net positive for the company, just on a financial level (morality aside).
It could be, but it's notoriously hard to predict. Those 10 productive workers could join (or form) a competitor and result in far more damage to revenue than was saved in labor costs across all 100 of the laid off workers, for example.
Everything in business is very difficult to predict and it's the realm of gut feelings and vague probabilities. Executives just make the best decisions they can.
I guess the problem is that "best" depends on perspective.
Everyone has a different perspective, but at the end of the day, some companies do better or worse than others to the benefit or detriment of the shareholders.
Every profitable company is accurate enough with its assessment of costs-vs-value-generated to "know" which employees are worth keeping, and which aren't