Heat a large sauté pan over medium-low heat. Add the oil/butter.
Once the butter has melted and is hot, add as many onions to the pan as will fit in a ½ inch layer in the pan. Sprinkle the salt over the onions. The salt helps to draw water and dissolved sugars out of the onion’s cells.
When you salt the onions at the beginning, it will take longer to achieve browning because of the extra water it draws out, but ultimately, your onions will have a much better flavor and will brown more evenly if you add the salt at the beginning of the cooking process.
Cook the onions over medium low heat. Cooking the onions at a relatively low temperature, called sweating, allows all the water to release into the pan and then evaporate slowly. Sweating also ensures that your onions will be soft and caramelized all the way through, and not just on the outside.
Stir the onions every couple of minutes, and adjust the heat so you here just the merest sizzle. If your pan would not hold all of the onions, add more as the ones in the pan cook down and free up more room in the pan.
Add in your optional ingredients, if you choose to use them, and continue cooking on medium-low to low heat, stirring frequently, until the onions are soft and anywhere from honey-colored to deep brown, depending on how caramelized you want them to be.
The process can take anywhere from ten to fifteen minutes to upwards of half an hour, depending on how many onions you are cooking and your preferred level of caramelization. Don’t worry; as long as you cook them slowly and stir them frequently, you will not end up with burned onions.
Other vegetables related to onions (the Allium family) also respond beautifully to caramelization. Try caramelizing leeks, shallots or even garlic.