  Deriving the laws of thermodynamics from a microscopic picture is a central
quest of statistical mechanics. This tutorial focuses on the derivation of the
first and second law for closed and open quantum systems far from equilibrium,
where such foundational questions also become practically relevant for emergent
nanotechnologies. The derivation is based on a microscopic definition of five
essential quantities: internal energy, thermodynamic entropy, work, heat and
temperature. These definitions are shown to satisfy the phenomenological laws
of nonequilibrium thermodynamics for a large class of states and processes. The
consistency with previous results is demonstrated. The framework applies to
multiple baths including particle transport and accounts for processes with,
e.g., a changing temperature of the bath, which is determined microscopically.
An integral fluctuation theorem for entropy production is satisfied. In
summary, this tutorial introduces a consistent and versatile framework to
understand and apply the laws of thermodynamics in the quantum regime and
beyond.

Quantum Physics;Statistical Mechanics