I know that magnetos are related to the engine and that on many planes, they are used to start the engine. But what exactly do they do in the engine?
A magneto is a gear driven electric generation device connected to the crankshaft of the engine. It supplies the ignition system (spark plugs) with power.
Each engine has two magnetos. Each cylinder has two plugs. Each magneto supplies one plug in each of the cylinders. This makes the ignition system redundant. If a magneto fails, the other magneto can sustain the engine.
Since the rest of the aircraft's electrical system is supplied by a belt driven alternator/generator, the engine is electrically isolated from any other electrical issues. If you lose electric power in the cockpit, your engine will still run. If you have to shut off electricity because of a cockpit fire, your engine will still run.
The scale of the image below is a little distorted. I had to get my phone pretty close to the oil filter for sufficient lighting.
A mag is in effect a completely self-contained old-style generator/points/coil/distributor ignition system all crammed into a housing the size of two blocks of butter.
The drive off the engine accessory case spins an internal permanent magnet a/c generator, which energizes the primary windings of a built-in ignition coil, whose electromagnetic field is interrupted and caused to collapse at a specific sweet spot in the a/c voltage curve by the built-in breaker points, causing a voltage surge in the secondary windings of the built in coil, which goes out a built-in distributor to the plugs.
Take the points/coil system from a 1960s car, eliminate the battery and just include the car's generator, and you have what is in effect a magneto blown apart and spread around under the hood (although not exactly; the mag makes its power with an internal a/c current, not a dc current).
Because the power comes from an internal permanent magnet generator, they don't make much spark until spinning at a couple hundred RPM, so they need to be helped during start by a clock spring wind-up device, an impulse coupling, in the drive that temporarily stops rotation into the mag and stores the movement in the clock spring, then lets it go suddenly so the drive going into the mag spins really fast for a split second. That's the CLICK you hear when you turn the engine by hand. The mag can't make enough energy to get a decent spark at cranking speeds so starting an engine without an impulse can be tough. The impulse coupler uses a centrifugal flyweight dog clutch to disengage itself as soon as the engine starts to spin quickly at start.
Mags have a fixed timing setting as well (typically mid 20s deg TDC), too advanced for starting (if you do get a spark it can make the engine kick back), so the impulse function also retards the spark while it's doing its job.
You could put an impulse on both mags, but it isn't really necessary for starting and it's a failure mode, so they are almost always installed on the left mag only and if you have key ignition it only enables the left mag when at START. You turn a mag off by grounding out the primary circuit with the ignition switch to prevent the field-collapse function from occurring. It'll still send a small voltage to the plugs if you spin it but not enough to jump the plug gap.
You have two of them partly for redundancy, and partly because the cylinder diameter is so large on piston engines the flame front takes quite a while to get across, so it's a lot more efficient to light the flame from two sides at once.
You know, in a gasoline engine, we're putting gasoline and air into a cylinder in the engine, and then stuff happens, and plane goes zoom.
Well, the gas and air won't light itself on fire; it must be lit by something, and at a very specific time.
So, it uses a spark of electricity, in a "spark plug".
This shot of electricity is made the old fashioned way, by waving a magnet across a coil of wire. The coil of wire is designed by experts to do the right thing. It's a common magnet, though a pretty strong one.
How do they get the timing right? They put the magnet on a moving part of the engine, so it sweeps the coil at the right time.
Cars do this in a much more complicated way, with sensors feeding a computer which drives electronics and transformers. This is more reliable overall, but gives no warning of failure.
The airplane magneto would fail sooner, except they are overhauled at regular intervals, and that lets them see trouble coming. Still, many airplanes use two of them.
a magneto is a coil that reacts to a magnet fitted on the shaft in order to generate electricity for the spark plugs alone. is already set and timed for spark. it is redundant for this reason and independent of the alternator that generates auxiliary electrical power. is a vital component meant to still maintain spark power for emergency situations, but not meant to provide electrical power for any electrical auxiliary.
you may find magneto also on the boat engine, because of its inherent simplicity and reliability.