How should I fry onions without burning them?
You may need to use a little more oil/butter, but the biggest things are to not get them too hot, and to stir them fairly often. Once they're sizzling that's hot enough. Some cookers will get keep getting hotter for quite a while, so you may need to turn them down preemptively. Heavy pans will do the same but overall tend to make gentle cooking easier. You can put a lid on with quite a gentle setting, opening the pan to stir. This makes for more even cooking, but you have to turn the heat down even lower than when not using the lid. 

Recipes often imply that softening onions is quicker than is really the case, so be patient.