More than 1000 exoplanets with a radius smaller than twice that of the Earth are currently known, mainly thanks to space missions dedicated to the search of exoplanets. Mass and radius estimates, which are only available for a fraction (∼ 10%) of the exoplanets, provide an indication of the bulk composition and interior structure and show that the diversity in exoplanets is far greater than in the Solar System. Geophysical studies of the interior of exoplanets are key to understanding their formation and evolution, and are also crucial for assessing their potential habitability since interior processes play an essential role in creating and maintaining conditions for water to exist at the surface or in subsurface layers. For lack of detailed observations, investigations of the interior of exoplanets are guided by the more refined knowledge already acquired about the Solar System planets and moons, and are heavily based on theoretical modelling and on studies of the behaviour of materials under the high pressure and temperature conditions in planets. Here we review the physical principles and methods used in modelling the interior and evolution of exoplanets with a rock or water/ice surface layer and identify possible habitats in or on exoplanets.