One of my favorite things to do in the kitchen! The key is LOW & SLOW. Low heat, and occasional stirring with a rubber spatula. I probably cooked these a tiny bit too long given the fact that they were going to be baked in the recipe, but its all personal preference. You can also chop the onion in small pieces rather than rings.
When can you use caramelized onions? Pretty much on anything. They add great flavor to any basic rice or quinoa dish. Throw them in an omelette or on top of a salad.
Cut onions to 1/4-1/2 rings or pieces. Add 1-2 tbsp oil (better to start with 1 and add more) and leave the heat on low-medium. Stir occasionally as the onions turn translucent, then caramel colored, and then brown. Whole process could take up to 20 minutes depending on the amount of onions and the pan.