How it works?
Fusion needs a very high temperature.
In normal conditions, atom nuclei don’t fuse spontaneously. The nucleus is positively charged and electrostatic forces will repel each other long before they come so close that strong nuclear forces can start to act and bind nuclei together. The Coulomb forces that repel nuclei are long-range forces. On the other hand, strong nuclear forces are short-range forces acting at distances of about 1 femtometer (10−15 meter). When two similarly charged particles are more than 2 femtometres apart, strong binding forces are nearly negligible and they are repelled from each other by electrostatic force.
Basically, there are two ways how to overcome repulsive forces and bring nuclei so close that they can fuse. First is to give them enough velocity so that their inertia overcomes repulsive forces and nuclei will have the possibility to fuse. The second is to apply some external force on the nuclei stronger than the Coulomb one that will put the nuclei together.
To have velocity at the particle level means to have temperature. The higher the temperature, the greater the velocity of particles. With temperatures exceeding several million Kelvin, the particles velocity are high enough to enable them to fuse. The necessary temperature differs according to the type of nuclei that are going to be fused. For proton-proton fusion which takes place in the core of our Sun, the temperature of around 15 million Kelvin will be enough. But because it is a reaction with a very low cross-section, for terrestrial energy production, the deuterium-tritium reaction with an ignition temperature about 150 million Kelvin should be used. Other types of fusion reactions require even higher temperatures. For example, to fuse a proton with boron11, you will have to heat it to more than 1 billion Kelvin.
There are plenty of ways how to compress matter. Stars are using gravity that squeezes their enormous masses so that the fusion is ignited in their cores. A suitably directed shock wave cloud gives particles enough momentum to compress themselves to a very small volume. Particles could be squeezed by a magnetic field either generated externally or created by strong electric currents flowing through the plasma column. Even very improbable methods have been examined — one of the “cold fusion” ideas was that the deuterium atoms adsorbed on palladium electrodes during electrolysis can get close enough to fuse. This idea was never proven.
Heating and compression are not separate requirements as it might seem. When you compress something it will heat itself up, so great compression will often lead to high temperatures. And the high temperature alone would not be sufficient enough if the probability of meeting another particle is too low, so some sort of compression will always be needed.