First we survey the literature on knots and links in theoretical physics. Next, we report a numerical study in which equilibrium configurations of ring polymers in an infinite space, or confined to the interior of a sphere, are generated. By using a new algorithm, the a priori probability for the occurrence of a knot is determined numerically. The results are compatible with scaling laws of striking simplicity. We also study the mutual entanglement of links, comparing the Gauss invariant with the Alexander polynomial.