Temporal coupled-mode theory (CMT) is an acclaimed and widely used theoretical framework for modeling the continuous-wave response and temporal dynamics of any integrated or free-space photonic resonant structure. It was initially employed to understand how energy is coupled into and out of a cavity and how it is exchanged between different resonant modes. In the 30 years that followed its establishment, CMT has been expanded to describe a broad range of nonlinear interactions as well (self- and cross-phase modulation, saturable absorption, frequency generation, gain, etc.). In this Tutorial, we thoroughly present the basic principles and the evolution of CMT throughout the years, showcasing its immense capabilities for the analysis and design of linear and nonlinear resonant photonic systems. Importantly, we focus on the examples of modern, open nanophotonic resonators incorporating contemporary bulk or sheet (2D) materials that may be lossy and dispersive. For each linear/nonlinear effect under study, we follow a meticulous, step-by-step approach, starting from an accurate model of the physical phenomenon and proceeding to its introduction in the CMT framework all the way to the efficient solution of the resulting system of equations. Our work highlights the merits of CMT as an efficient, accurate, and versatile theoretical tool. We envision that it can serve both as an introductory reference for any reader and as a comprehensive handbook on how to incorporate a broad range of linear and nonlinear effects in the CMT framework.