There are two factors that need to be considered to answer your question - entropy and enthalpy.
Entropy favors the formation of smaller rings. If we consider a hydrocarbon chain, the number of possible conformations increases dramatically as we go from 3 carbons to, for example, 10 carbons. Only a few of these conformations will be correctly arranged so that the two ends of the chain are close to each other, which is necessary if we are to form a bond. So, entropically speaking, it will be much more probable to form a 3-membered ring than a 10-membered ring. This is shown in the following graph where 3-, 4- and 5-membered ring formation is entropically most favored.
Note that a less negative $\Delta S$ favors the reaction since $\Delta G=\Delta H - T \Delta S$.
Enthalpy comes into play when we consider the strain in the transition state leading to the possible products. Here is a chart showing the relative ring strain as a function of ring size.
As expected, strain is the highest in 3- and 4-membered rings.
If we overlay (add) these entropic and enthalpic effects we would get a graph similar to the one pictured below.
In general, we find that 5-membered ring formation is usually the favored pathway. This web article (J. Am. Chem. Soc. 1984, 106, 1051-1056.) is a nice review of this topic that may be useful for a more in-depth reading on the subject. The above web article is also the source of the above three images.