Petrol engines require a spark at the right time to fire the air/fuel mix which in turn pushes a piston (or spins a rotor or wobbles a wobbleboard or...) There are several ways to make a spark - kettering points charged coil, magneto, flint and a stone - but I'm talking CDIs.
Lets get straight to it. Have a look at the diagram. This is all you'll ever need for your motorbike to run be it 2 stroke or four stroke. Nothing else. That's right. No battery, no regulator, no rectifier - all that junk is for lights and other boring stuff.
Notice that there are a couple of coils (or windings). These literally are wire wrapped around iron. What does wire wrapped arond iron do?
Quick in-a-nutshell physics lesson: When you have a coil with electricity flowing thorugh it this creates a magnetic field. And vice versa - if you have a magnetic field near a coil it will make electricity flow in it. Straight away you can see what the Exciter Coil is doing then. That grey blob underneath it is actually a magnet on the rotor in your engine and it spins around the exciter coil making electricity.
So the first thing that happens is that the engine, spinning a magnet, makes the power for the CDI. How much power? In fact, the faster the engine spins the more voltage is produced to feed the CDI. This may be in the order of 100VAC at peak revs.
Pulse sensor - another coil, but only a small one. It too has a magnet spinning near it - but the magnet only passes by the coil once per revolution and it's a real small magnet. This means that most of the time there is not electricity flowing in the pulse sensor - but when the magnet passes by the coil you get a tiny spike of electricity. This tells the CDI to make a spark as the magnet is cunningly positioned so that the spike hits the CDI at just the right time
There are another 2 windings being The Coil. As in the ignition coil, the one the spark plug connects to. Expanded in-a-nutshell physics lesson: the more turns in a winding, the more voltage; less windings, more current. The "coil" is actually 2 windings, the left hand side only a few turns and the right hand side with lots of turns.
If you put voltage in the few turns side, this makes a magnetic field (remember, electricity = magnetic field) and then the other coil with lots of turns gets electricity in it because of the magnetic field from the first one. Because of the many turns the voltage is much higher but the current much lower. Confused?
Having two coils inducing magnetic fields in each other is called a transformer - it takes a low voltage and turns it into a high voltage. This is to create a spark, which is actually just electricity managing to travel through air (_everything_ will conduct electricity if the voltage is high enough; a compressed air/fuel mix requires at least 10,000 volts).
The CDI itself is a timed energy store and discharge switch. It sits there storing up electricity in a capacitor (ie the "C" in "CDI"), then the pulse sensor triggers the CDI, which waits a small amount of time and then bursts the electrical energy stored in the capacitor straight into the coil, creating a spark at the plug. That small amount of time represents the advance curve of an engine, based on engine speed, ie at idle an engine may need 10 degrees advance but at full revs it may need 40 degrees advance. By delaying the signal and having the pulse sensor in the right place, the CDI can make sure the engine is getting the right advance curve.
Rounding it off, the CDI is connected to ground (so that electricity can flow) and an Engine Kill Switch will short out the CDI resulting in no spark and thus the engine will stop.
The actual internals of the CDI is another story...