If you're a nonresident alien, less of your income will be taxed, but figuring out how much is a more complicated process. You're taxed on business and trade-related earnings, as well as interest on investments. Investment earnings are taxed at a flat 30 percent, and you can't take any kind of deductions from those earnings. Business and trade income is taxed the same as it is for U.S. citizens and resident aliens, at varying rates based on the amount of income. You can deduct certain expenses from this income -- the details of tax deductions are, again, beyond the scope of this article. You'll use form 1040NR or 1040NR-EZ to file your taxes (if you have investment income, you can't use 1040NR-EZ, it has to be 1040NR).
Dual-status aliens have the most work to do. You'll have to calculate your income for each part of the year -- the part when you were a nonresident alien on form 1040NR, and the part when you were a resident alien (on form 1040). You'll be taxed on each part of your income based on your residency during that time.
There are a few other options and exceptions to be aware of. For example, many of these tax rates and rules may be superseded by any tax treaties between your home country and the U.S. Also, taxes you pay to your home country may allow you to take a foreign tax credit whether you're a resident or nonresident alien (some countries are not eligible for this). Do note, however, that nonresidents cannot take a foreign taxes deduction (Schedule A) like residents can. If you meet a particular set of criteria, it's possible to choose resident status for a year when you would otherwise have nonresident status. A tax expert or tax prep software can help you determine if you can and should use this exception, known as first-year election.
One final point: You also will probably have to pay income tax in the state or states where you work and reside while in the U.S., but the exact amount and how the state's income tax laws handle foreign nationals varies from state to state.
The U.S. tax system can be a maze even for U.S. citizens. Add in the complications of being taxed as a foreign national, and the possibility that English isn't your primary language, and it can seem incredibly difficult to understand. Because there are so many variables, based on your home country, the state you're in, the tax treaties involved and other factors, seeking out professional tax resources at your place of employment or school would be very helpful.