Understanding the dynamics of electron or nuclear spins during a magnetic resonance experiment requires to solve the Schr€ odinger equation for the spin system considering all contributions to the Hamiltonian from interactions of the spins with each other and their surroundings. In general, this is a difficult task as these interaction terms can be both time-dependent and might not commute with each other. A powerful tool to analytically approximate the time evolution is average Hamiltonian theory, in which a time-independent effective Hamiltonian is taking the place of the time-dependent Hamiltonian. The effective Hamiltonian is subjected to the Magnus expansion, allowing to calculate the effective Hamiltonian to a certain order. The goal of this paper is to introduce average Hamiltonian theory in a rigorous but educational manner. The application to two composite pulses in NMR spectroscopy is used to demonstrate important aspects of average Hamiltonian theory. K E Y W O R D S average Hamiltonian, average Hamiltonian theory, composite pulse, effective Hamiltonian, Magnus expansion