This paper is the first in a series that lays the groundwork for a structure and classification theory of second-order superintegrable systems, both classical and quantum, in conformally flat spaces. Many examples of such systems are known, and lists of possible systems have been determined for constant curvature spaces in two and three dimensions, as well as few other spaces. Observed features of these systems are multiseparability, closure of the quadratic algebra of second-order symmetries at order 6, use of representation theory of the quadratic algebra to derive spectral properties of the quantum Schrödinger operator, and a close relationship with exactly solvable and quasi-exactly solvable systems. Our approach is, rather than focus on particular spaces and systems, to use a general theoretical method based on integrability conditions to derive structure common to all systems. In this first paper we consider classical superintegrable systems on a general two-dimensional Riemannian manifold and uncover their common structure. We show that for superintegrable systems with nondegenerate potentials there exists a standard structure based on the algebra of 2×2 symmetric matrices, that such systems are necessarily multiseparable and that the quadratic algebra closes at level 6. Superintegrable systems with degenerate potentials are also analyzed. This is all done without making use of lists of systems, so that generalization to higher dimensions, where relatively few examples are known, is much easier.