Over the past few months, I've been doing quite a bit of research into coilguns and how the work, so I thought I'd do a write-up on them.
When a conductive wire, such as copper wire, is rolled up into a coil, and an electric charge is applied to it, it creates an electromagnetic field. The higher voltage applied to it, the larger the field. This means that a metal object will be pulled towards the coil with more force if more voltage is put through the coil.
A coilgun operates with this basic principle. The copper coil is wrapped around a plastic barrel(it doesn't have to be plastic, just a material that doesn't conduct electricity). Then, a very large charge is released into the barrel over a very short period of time, creating a quick but extremely powerful magnetic field. When a bullet is placed in the barrel, a short length behind the coil, the magnetic field pulls it towards the coil with great force, causing the bullet to fly down the barrel with great speed.
The large burst of energy required for the coil is generated with the use of a capacitor. a capacitor is much like a battery, in that it stores energy. However, a capacitor can release it's energy much faster than a battery. So if a high voltage capacitor fully charged, then connected to a coil, it will release all the energy into the coil very quickly.
When talking about coilguns, you may hear the term 3 stage, or sometimes 3 phase. This simply means that multiple coils are used to keep the bullet at constant acceleration down the barrel.