This chapter is an introduction to shape and topology optimization, with a particular emphasis on the method of Hadamard for appraising the sensitivity of quantities of interest with respect to the domain, and on the level set method for the numerical representation of shapes and their evolutions. At the theoretical level, the method of Hadamard considers variations of a shape as "small" deformations of its boundary; this results in a mathematically convenient and versatile notion of differentiation with respect to the domain, which has historically often been associated with "body-fitted" geometric optimization methods. At the numerical level, the level set method features an implicit description of the shape, which arises as the negative subdomain of an auxiliary "level set function". This type of representation is well-known to be very efficient when it comes to describing dramatic evolutions of domains (including topological changes). The combination of these two ingredients is an ideal approach for optimizing both the geometry and the topology of shapes, and two related implementation frameworks are presented. The first and oldest one is a Eulerian shape capturing method, using a fixed mesh of a working domain in which the optimal shape is sought. The second and newest one is a Lagrangian shape tracking method, where the shape is exactly meshed at each iteration of the optimization process. In both cases, the level set algorithm is instrumental in updating the shapes, allowing for dramatic deformations between the iterations of the process, and even for topological changes. Most of our applicative examples stem from structural mechanics although some other physical contexts are briefly exemplified. Other topology optimization methods, like density-based algorithms or phase-field methods are also presented, at a lesser level of details, for comparison purposes.