I had accidentally overloaded a circuit when I plugged something into an outlet but it caused another outlet in the same circuit (which had some, but not much power being drawn through it) to burn up. Fortunately, the circuit breaker tripped and nothing bad happened, but I'm wondering why this could have happened so I can prevent it form happening again.
Note: I'm assuming you are in North America.
Most likely, the power passed through the "bad" outlet on its way to the outlet you overloaded. A standard US outlet (pair) has two screws each for the hot and neutral, as well as two "back-stab" holes for each. It is not uncommon to connect the wires coming from the breaker box to one pair and the wires going to the next outlet to another, rather than joining the wires and running "pigtails" (short wires) to the intermediate outlet.
If one of the connections is not making good contact, the resistance will generate heat under the heavy load and this can damage the outlet. Most likely, the back-stabs were used, which are known to come loose.
(Side note: the reason there are two sets of connections is to allow isolating each of the two outlets, for example, if you wanted only one outlet switched. There are metal tabs on both sides of the assembly connecting the top to the bottom. These can be broken off. If you are examining an outlet and either or both tabs has been removed, then something else may be happening with that outlet.)
[Excuse the poor drawing]
You can also avoid running the power through the outlets by using wirenuts and pigtails to the screws on the outlet. This avoids running the power through the outlet to the next and is marginally better than the previous.
If I were you, I'd check (or hire someone to check) each outlet in your home. Look for signs of damage from heat and replace any such outlets. Also, if the back-stabs were used, change to use the side screws instead or use wirenuts with pigtails to the side screws.
If you do replace any outlets, check if either of the metal tabs has been removed. If so, make sure to break off the same tabs on the new outlet and don’t change the wiring unless you understand how it works.
Also check the tightness of any screws already in use.
Outlets are often connected in a series, with current for all loads passing through the contacts on each side of each outlet. If a connection is going to fail, it's usually the one with the poorest contact, which generates the most heat.
Some electricians pigtail the wiring in each box to avoid this problem. An outlet only carries the current to loads connected directly to it.