Add salt to onions *after* they begin to soften and turn translucent, but before they fully caramelize. This helps draw out moisture initially and prevents burning later.
Adding salt at the very beginning of caramelizing onions can draw out too much moisture too quickly, essentially steaming the onions instead of allowing them to brown properly. This extends the cooking time significantly and can result in a less flavorful caramelization. However, adding salt too late means it won't properly integrate into the onions as they break down. The ideal time is when the onions have started to soften and become translucent. At this stage, the salt helps to further draw out moisture, concentrating the sugars and promoting browning. It also seasons the onions evenly as they continue to cook down. You'll notice the onions will start to develop a richer, deeper color and a sweeter aroma. Continue cooking over low heat, stirring occasionally, until they reach your desired level of caramelization.
Don't overcrowd the pan! Overcrowding lowers the pan's temperature and steams the onions. Cook in batches if necessary to ensure even browning and proper caramelization.