For large batches of nuts, spread them on a sheetpan in a single layer and toast them in a 400-degree oven for about 10 minutes. Shake the pan occasionally during this time to make sure the nuts toast evenly. The nuts are done when their color has deepened and you can smell their aroma.
For smaller batches, you can toast them in a dry (un-oiled) pan over medium heat. Shake the pan constantly to prevent burning, and the nuts are toasted when they're evenly brown and have an aroma.
It's best to toast only as many nuts as you'll be using immediately. The intense toasted flavor diminishes with time.
Related: How to Remove the Skins from Nuts