Experience. But it all depends. TDP gives a hint in some generations example epyc cpus TDP is relaivly acurate wheras the 35w tdp of intel second gen means litteraly anything between 10 and 60w.
But for consumer systems with an i or r5 cpu and a mid tier gpu 500w is enough. For a server without a gpu and similar cpu 300W will suffice.
dual socket systems of that cpu class maybe 400-500.
With more enterprise stuff 500-700 or with epyc maybe encroaching 1000w with some addin cards.
It depends on maany other variables like Drives attached, PCIe devices used etc.