Burning is commonly associated with the executions for witchcraft, chiefly because it has been practiced in the areas most notorious for the 16th and 17th century witch hunts, i.e. Holy Roman Empire , especially its southwestern parts, where the executions of alleged magic users in this particular regions accounts for a third to a half of total cases of such executions in Europe and its colonies.
Salem was located in New England, and nominally was subject to the English law according to which, the punishment for witchcraft resulting in death or harm to another person was death by hanging. This measure has been introduced by Henry VIII in the Acts of 1542 defining witchcraft as an use of magical means used to cause death, harm, enthrallment resulting in 'forcing one to unlawful love', desecration, finding lost objects, conjuration or communication with spirits and making it punishable by hanging. This particular act has been repealed five years later by Henry's successor, Edward VI, but a similar Act Against Conjurations, Enchantments and Witchcrafts has been passed by Elisabeth I in 1562 and later expanded by James I in 1604. Many inhabitants of England, including Ursula Kemp (1582), Elisabeth Clarke (1645) and ten out of eleven people accused in the Lancaster Witch Trials of 1612, one of the best known and documented trial of that kind in England were also executed by hanging. Please note that Giles Corey, one of the accused in Salem Witch Trial refused to enter a plea and was consequently pressed to death in accordance with the common English regulations.
In the German areas, burning became closely associated with witchcraft in 1532 with the adoption of the Constitutio Criminalis Carolina under Emperor Charles V that mandated qualified death penalty of burning at the stake for witchcraft, money counterfeiting, 'deeds against nature' (sexual misconduct including i.e. homosexual contacts, bestiality and incest), arson and theft of the Holy Sacrament. This legal codex, although accepted throughout 16th century as the main law source only in several German-speaking regions of Europe in Holy Roman Empire, Austria and Switzerland, became an auxiliary law in most Germanic areas, but also found limited reception in Scandinavia and Polish-Lithuania Commonwealth, usually in the cities located in accordance with Magdeburg law. This notion against witchcraft in this area is also visible in e.g. Bavarian Witchcraft Mandate enacted by Duke Maximilian I in 1611, where death by burning was a punishment for all who actively partake in magic or pacts with the devil, although it also mentions different punishments for people who use services of sorcerers, from beheading if such services were meant to kill or harm someone, to small fines in case of superstitions or fortune-telling.
Other regions of Europe usually saw less uniformity in the methods of executions for alleged witchcraft, chiefly due to less universal laws governing them, as the courts of the particular regions were using local laws. If the alleged magic-users were sentenced to death penalty (what was generally less common that in Holy Roman Empire), it could have been carried out by burning (especially in the areas influenced by German law), but also by hanging, beheading or, in rare cases, also drowning.
So, long story short, alleged witches were hanged in Salem but burned in Germany, because this was the punishment mandated by the law in the respective regions.
Levac, B.P., The Oxford Handbook of Witchcraft in Early Modern Europe and Colonial America. Oxford University Press, 2013.
Wesel, U., Geschichte des Rechts: Von den Frühformen bis zur Gegenwart [History of law: From the early forms to the present]. C.H.Beck, Munich 2001.