Several experimental methods are usually applied for stretching single molecules and provide valuable insights about the static and dynamic responses induced by externally applied forces. This analysis is even more important for macromolecules exhibiting conformational transitions, thereby corresponding to folding/unfolding processes. With the aim of introducing the statistical mechanics of such phenomena, we apply here the spin variables approach based on a set of discrete quantities able to identify the folded or unfolded state of the chain units. First, we obtain the macroscopic thermodynamics of the chain from its microscopic description. For small systems, far from the thermodynamic limit, this result depends on the applied boundary condition (e.g., isometric or isotensional), which corresponds to the considered statistical ensemble. Then, we develop the theory for the two-state extensible freely jointed chain, where the elastic constant of the units, a property often neglected, plays a central role in defining the force-extension curve. For this system, the partition function of the isometric ensemble can be written in closed form in terms of the natural generalization of the Hermite polynomials, obtained by considering negative indices. These results are relevant for the interpretation of stretching experiments, operated from the entropic regime up to the unfolding processes.