I'm closing out my retirement and I was wondering how the irs knows you paid the taxes on the amount you withdrew. I do not want to pay twice.

Let say i withdrew 6,000 from my retirement, but I choose to pay the taxes upfront instead of when taxes are done.