How do particle accelerators like the LHC bend beams of particles? I know they use dipole magnets to curve the beams, and quadrupoles to focus them, but how do they know how powerful the magnets need to be so they bend the beams sufficiently but not too much so that they don't curve into the side of the tunnel?
 A: The Lorentz force acting on moving particles provides the centripetral force
the particles have to be exposed to for making them follow a curved trajectory:
$$F_{Lorentz}=F_{centripetral}$$
means ($p=\gamma mv$ with $\gamma = (1-(\frac{v}{c})^2)^{-1/2}$, with $c$ corresponding to the speed of light and $v$ the velocity of the particle, $m$ is the mass of the particle):
$$evB = \frac{\gamma mv^2}{R} \quad \text{or} \quad  \frac{1}{R} = \frac{e}{p}B $$
from which "any" curvature radius $R$ needed can be achieved by choosing the adequate strength of the magnetic field $B$. The magnetic field is generated in the dipoles (also called bending magnets) and acts perpendicular to the plane in which the trajectory lies.  Remember that only if the magnetic field has not  the same direction as the motion of the particle the Lorentz force can act (i.e. is non-zero). In particular if the magnetic field is perpendicular to the motion of the particle the resulting force $F_{Lorentz}$ is the largest. $p$ corresponds to the momentum of the particle and is relativistic ($v\cong c$) in case of the LHC.
