1) Before tax 401k contribution: All withdraw from your account is will be your income for that year.2
2) after tax 401k contribution: the original contribution will not be taxed. The earning/return from your contribution will be taxed as part of your income.
Your broker know how much earning/original contibution from your accout.