This text is written to teach the theory of Lyapunov drift and Lyapunov optimization for stochastic network optimization. It assumes only that the reader is familiar with basic probability concepts (such as expectations and the law of large numbers). Familiarity with Markov chains and with standard (non-stochastic) optimization is useful but not required. A variety of examples and simulation results are given to illustrate the main concepts. Diverse problem set questions (several with example solutions) are also given. These questions and examples were developed over several years for use in the stochastic network optimization course taught by the author. They include topics of wireless opportunistic scheduling, multi-hop routing, network coding for maximum throughput, distortion-aware data compression, energy-constrained and delay-constrained queueing, dynamic decision making for maximum profit, and more.