The Les Houches Summer School in August 2015 covered the emerging fields of cavity optomechanics and quantum nanomechanics. Optomechanics is flourishing and its concepts and techniques are now applied to a wide range of topics. Modern quantum optomechanics was born in the late 1970s in the framework of gravitational wave interferometry, with an initial focus on the quantum limits of displacement measurements. Carlton Caves, Vladimir Braginsky, and others realized that the sensitivity of the anticipated large-scale gravitational-wave interferometers (GWI) was fundamentally limited by the quantum fluctuations of the measurement laser beam. After tremendous experimental progress, the sensitivity of the upcoming next generation of GWI will effectively be limited by quantum noise. In this way, quantum-optomechanical effects will directly affect the operation of what is arguably the world's most impressive precision experiment. However, optomechanics has also gained a life of its own with a focus on the quantum aspects of moving mirrors. Laser light can be used to cool mechanical resonators well below the temperature of its environment. After proof-of-principle demonstrations of this cooling in 2006, a number of systems were used as the field gradually merged with its condensed matter cousin (nanomechanical systems) to try to reach the mechanical quantum ground state, eventually demonstrated in 2010 by pure cryogenic techniques and just one year later by a combination of cryogenic and radiation-pressure cooling. The book covers all aspects -- historical, theoretical, experimental -- of the field, with its applications to quantum measurement, foundations of quantum mechanics and quantum information. It is an essential read for any new researcher in the field.