The electrostatic interaction between a model probe and a sample in a scanning probe microscope is analyzed. A simple model for a real experimental setup is proposed and solved by means of an appropriate approximation. In addition, a quantitative definition for resolution is presented. We find that generally the total force between tip and sample is dominated by contributions which are not confined to a nanometer-sized region under the tip apex. From our analysis we conclude that such a confinement is only obtained either with specially designed probes or by using the force gradient as signal source. We show that reliable experimental data acquired by local Kelvin probe microscopy can only be obtained if these considerations are taken into account. Finally, we propose an experimental setup which optimizes resolution and gives the correct local surface potential in the case of Kelvin probe microscopy.