Circadian rhythms are generated at the cellular level by a small but tightly regulated genetic network. In higher eukaryotes, interlocked transcriptional-translational feedback loops form the core of this network, which ensures the activation of the right genes (proteins) at the right time of the day. Understanding how such a complex molecular network can generate robust, self-sustained oscillations and accurately responds to signals from the environment (such as light and temperature) is greatly helped by mathematical modeling. In the present paper we review some mathematical models for circadian clocks, ranging from abstract, phenomenological models to the most detailed molecular models. We explain how the equations are derived, highlighting the challenges for the modelers, and how the models are analyzed. We show how to compute bifurcation diagrams, entrainment, and phase response curves. In the subsequent paper, we discuss, through a selection of examples, how modeling efforts have contributed to a better understanding of the dynamics of the circadian regulatory network.