Compute the employee's gross pay for the pay period (wages, tips, salary, commissions, etc).
Subtract any "pre-tax deductions" (med ins premiums, retirement, etc). This is the employee's "pre-tax net pay".
Divide $3800 (thethe amount one W-4 allowance is worth annually (for 2012, that's $3800) by the number of pay periods in the tax year (e.g 26 for bi-weekly). Multiply this by the number of allowances claimed on the W-4 and subtract it from the pre-tax net pay to determine the "pay subject to withholding".
Taxes are computed "piecewise"; dollar amounts up to A are taxed at X%, and then dollar amounts between A and B are taxed at Y%, so total tax for B dollars is A*X + (B-A)*Y. Here is the table of rates for income earned in 2012 on a daily basis by a person filing as Single:
More Than But Less Than W/H Base W/H Pct 0.00 8.30 0.00 0% 8.30 41.70 0.00 10% 41.70 144.20 3.34 15% 144.20 337.70 18.72 25% 337.70 695.40 67.10 28% 695.40 1501.90 167.26 33% 1501.90 433.41 35%