Power supplies for a lot of electronic devices do tend to stick to certain common voltages. Basically, a battery is 1.5 volts, so if the thing takes 2 batteries then it will have a 3 volt AC adapter, and if it takes 4 batteries it will have a 6 volt adapter. These AC adapters are designed to be as cheap as possible. They have very little filtering and often no voltage regulation. Generally speaking, as long as you match up the voltage, the connector type, the polarity of the connector, and the AC adapter can supply at least as much current as the one it is replacing, there’s usually not a problem. You don’t want to replace a 200 mA adapter with a 5 amp adapter, though, because often the voltage regulation in these things is really really crappy and relies on a certain reasonable load to function properly. A severely underloaded AC adapter may end up with a really high voltage output, which could possibly damage your device. There’s usually no problem with replacing a 200 mA adapter with say a 500 mA adapter, though, as long as the voltage, polarity, and plug match up.
One thing that goes against standardization is the fact that Sony wants you to buy the Sony AC adapter (for $30) instead of the equivalent Wally World adapter (same output, $3). So, Sony intentionally puts an oddball connector on the end of their adapter. I’m picking on Sony and exaggerating a bit, but a lot of companies do this.
The quest for smaller and smaller devices also hurts standardization. An ipod, for example, is so thin that the typical barrel connector used in AC adapters is just too fat be used in it.
For devices that really draw a lot of power, like laptops, the standardization really isn’t there. Laptops, being complicated digital devices, often have very specific voltage requirements, and sometimes can’t tolerate the poor regulation and lack of filtering common to generic AC adapters. Laptops often also use switching power supplies, which are a lot more efficient, but can be electrically pretty noisy. The laptop may be designed to filter off the switching frequency for the adapter it is designed to use. It may not have the filtering required to operate properly if a different adapter with a different switching frequency is used. A linear regulated adapter wouldn’t need to worry about switching frequencies, but linear power supplies are a lot larger, a lot less efficient, and run a lot hotter than switching power supplies.
The typical “wall wart” power supplies are usually pretty much as Leaffan described. They are just a transformer, often a single diode (not the 4 diode bridge, though you will find those also), and a capacitor for filtering. Because there is no regulation, if the voltage at the outlet is 10 percent low (the power company usually only guarantees +/-10 percent) then the output of the AC adapter will also be 10 percent low. Your 6 volt AC adapter could be anywhere from 5.4 volts to 6.6 volts depending on where you plug it in. You could also find that it is 7 volts without anything attached to it, and it’s only 5 volts (or less) at full load due to the thin wires and cheap components used in it. The capacitor is typically a bit undersized, so there is a lot of “ripple” in the adapter’s output.
Better (and more expensive) AC adapters will have voltage regulation circuits in them, so that the 6 volts out is always 6 volts even if the AC side varies a bit. The two types of regulators are “linear” and “switching”. Linear regulators are much less efficient, make a lot more heat, but they have a much more stable and less noisy output. Switching regulators often don’t work properly unless they have at least a 10 percent load on their output, and they are electrically as noisy as all hell. But, they are much more efficient and run a lot cooler. Almost all laptop power supplies these days are switchers just because of the efficiency issue.
You can google “switching regulator” and “linear regulator” for more detals.