Slow and steady wins the race
Every time I caramelize onions, I remember my cooking instructor repeating that mantra to the class. There is no cheating this process. Turning the heat up will just brown the onions. But if you can be the tortoise, you'll be fine: just keep the heat low, stir, and be patient.
Even slices for even caramelization
You can use any kind of onion. I tend to stick with regular yellow ones. Start with at least two onions—they'll shrink a lot.
After slicing an onion in half, cut out the root end, so that all the layers will easily separate from one another. Then cut thin, even lengthwise slices.
Start with a hot pan, then add fat
Add enough fat to give the onions a glossy coat. Use any kind of fat you'd like: olive oil, bacon fat, duck fat, butter. Since butter browns easily, though, it's a good idea to blend it with oil. Once the fat is hot and shimmering, stir in the onions and a good pinch of salt.
Before they caramelize, they sweat
As the onions sweat, they soften and release water. You can see the steam rise from the pan. As long as you are stirring frequently, you can keep the heat on medium. Once they are sweated (after about 5 minutes), turn the heat low and stir occasionally. If the pan gets dry, add a little more oil.
Slowly, it begins to caramelize
After almost 10 minutes, you can see the first hints of amber.
If brown bits start to form, deglaze.
Do this only when the onions are well-sweated—before that, you want to focus on getting liquid out, rather than adding it back in.
Pour in a tablespoon or so of broth, water, wine, or a few drops of vinegar and loosen the bits from the bottom of the pan. You can turn the heat up momentarily to encourage the liquid to evaporate. The flavorful brown bits, now dissolved, will get soaked up by the onions.
You can stop at any point depending on how deep you want the onions to be caramelized. Let's hang on a bit longer, stirring these delicate morsels carefully.
An example of what not to do
The phone rang, I got distracted. The result: well-browned on one side and not well-caramelized on either side. So, if you want to chat on the phone, chat and stir over a low heat.
Finally, nicely caramelized
These onions are perfect. If you want them to develop a molasses-like color and flavor, you could even go another ten minutes or so.
Notice how much the onions shrank since they were first put in the pan. If it's more than you need right away, though, you can keep them covered in the fridge for several days.