Depth-sensing nanoindentation, when the displacement the indenter is continuously monitored is widely used for analysis and estimations of mechanical properties of materials. Starting from pioneering papers by Bulychev, Alekhin, Shorshorov and their co-workers, nanoindentation tests are connected with Hertzian contact problems and the frictionless BASh relation is commonly used for evaluation of elastic modulus of materials. We discuss further the connections between Hertz type contact problems and nanoindentation tests and derive fundamental relations for depth-sensing nanoindentation for indenters of various shapes and for various boundary conditions within the contact region. For the loading branch, relations are derived among depth of indentation, size of the contact region, load, hardness, and contact area, using authors' scaling formulae. The relations are valid for indenters of non-ideal shapes, whose shape function is a monomial function an arbitrary degree d, in particular for blunted pyramidal indenters when 1 < d < 2. We show that some uncertainties in nanoindentation measurements, which are sometimes attributed to properties of the material, can be explained and quantitatively described by properly accounting for geometric deviation of the indenter tip from its nominal geometry. Then relation is derived for the slope of the unloading branch of adhesive (no-slip) indentation, The relation is analogous the frictionless BASh relation and it is independent of the geometry of the indenter. Further, the JKR theory of contact the presence of forces of molecular adhesion is extended to describe contact between a monomial indenter of an arbitrary degree d and an elastic sample. Finally, some exact formulae are obtained for adhesive contact (both the no-slip contact and the contact in the presence of molecular adhesive forces) between indenters and isotropic, linear elastic materials. In particular, it is shown that the BASh formula is still valid for contact between a flat punch and a soft elastic sample in the presence of molecular adhesive forces (the Boussinesq-Kendall problem).