Heat oil over medium heat until shimmery. Add onions and sauté, stirring frequently, until they begin to soften, about 5 minutes. Don’t worry if all the onions don’t fit at once; after you fill the pan, let those onions cook down a bit, then stir in the rest.
Add salt and sugar, lower heat slightly, and continue cooking, stirring frequently, until golden brown, for at least 15 minutes. For richer, sweeter onions, keep cooking for up to 2 hours, until dark and meltingly soft.
Whatever you do, don’t let the onions burn – if they seem to be cooking too quickly, lower the heat.