One recipe for caramelized onion uses onions, salt, fat and a liquid. The fat can be butter, olive oil or a mixture of the two. For the liquid, flavored stock, water, wine or vinegar are suitable.
Remove the root and skin of yellow onions, then slice them thinly to taste. Heat the butter or olive oil in a skillet until melted or it runs smoothly, then add in the onions. Coat the onions, and let cook, stirring regularly to prevent burning or sticking. Once the onions are cooked down, add salt for flavor, and pour in the liquid to ensure all the flavors come off of the pan. It takes at least 30 minutes for onions to begin to caramelize properly, and the longer they cook the more flavorful they are.
Alternatively, do not deglaze the pan at the end of the cooking cycle, and use sugar to enhance the flavor of the onions. Other varieties of onion lend well to being caramelized, but yellow onions are typically the most versatile. A cast iron skillet is the best option to get good color and flavor in the onions, but a stainless steel skillet is also appropriate. Caramelized onions are often used as a topping for sandwiches, burgers, pizzas and steaks.