Flexoelectricity refers to phenomena that polarization is coupled with strain gradient and stress is coupled with electric gradient. It occurs in all dielectrics, and becomes significant under a sharp conductive tip in piezoresponse force microscopy (PFM), under which large gradients in electromechanical field naturally arise. Here we analyze direct and converse flexoelectric effects under such a scanning probe, using mixed finite element method (FEM) developed under the phenomenological continuum framework. The FEM was first validated by analytic solutions for simple axially-symmetric tubes, and then applied to analyze two different modes of PFM experiments. It reveals that the flexoelectric effect accounts for less than 20% of the measured piezoresponse in a typical piezoelectric material, while mechanical switching via flexoelectricity is only possible for ferroelectric materials having upward polarization, with the switching zone confined to a small region near surface. These analyses explain a number of experimental observations well, and shed insight into complex electromechanical phenomenon under a sharp PFM tip. The theoretical and computational framework developed can also be applied to study flexoelectric effect in other structural configurations.