Why does soap make shaving with razor less painful? The lubricant is needed only on the hair surface? How can the blade cut the slippery surface?
Why does soap  make shaving with razor less painful?
 A: It helps to be a bit clear about what we mean when we say something is slippery or lubricated. Slipping occurs when only weak intermolecular attachments occur at an interface. Soap lubricates many solid surfaces because a soap/water mixture forms micelles, little balls of the soap "molecules" with a hydrophilic outer shell and a hydrophobic inner area (see http://en.wikipedia.org/wiki/Soap). These micelles can break and reform to create coatings on a surface in such a way as to lower intermolecular interactions between two objects (say, your foot and the floor). (Or, the little balls and water molecules just slide past each other, which produces the same effect.)
This effect is only slightly relevant to shaving in that it allows the razor to slide more smoothly across your skin. (Remember that the razor is almost parallel to your skin, so the physical situation is very close to two flat surfaces coming into contact. That's also why it can help to pull your skin taut.) Lubrication does very little to the hair because the razor, as a sharp edge, presents many more molecules per unit surface area when it encounters a hair than two flat surfaces coming into contact. The sharp edge of the razor is much more likely to find microscopic roughness in the hair and, from that starting point, cleave through.
So why does soapy water, or shaving cream, actually make a shave less painful, if it's not the lubrication? It's actually because the hair absorbs moisture and becomes softer. From a molecular perspective, water penetrates the outer layer of the hair (the cuticle), assisted by the soap (because the cuticle is hydrophobic), and gets into the interior of the hair (specifically, the cortex). (Hair structure: http://en.wikipedia.org/wiki/Hair#Description) This swells the hair and helps separate the keratin strands, lowering the density and making it easier for the razor to cut. So it's not so much the lubricating effect of the soap, but the hydrating effect, that provides the shaving assistance.
As a side note, the swelling of the hair when wet helps to lift it up slightly from the skin, which lets you cut the hair closer to the root. This effect can be sufficient to cut the hair so that, when dry, it sits slightly below the surface of the skin. That's why you also get a smoother shave when using some form of lubricant.
A: I guess answer from #Micheal is correct.
I would just like to add that the "pain" factor in shaving comes from friction of blade with the skin, removing some skin tissue causing pain. The fact that shaving
action of shaving is performed periodically(for most people) causes the thin hair(previously) when shaved to grow from thick base further resulting in thickening of the hair. This results in tightening of the hair in the follicle (http://en.wikipedia.org/wiki/Hair_follicle) which gives the feel of hardness of the regrown hair. Now the soap is a surfactant and plays the role of cleansing agent for skin and lubricating agent for hair. Since the oils in the follicle are cleansed by soap the water effectively hydrates the skin, resulting in softening of the hair and follicular clamp. This could result in swelling due to hydration is also the reason why hot water works better than cold water. End result is an easy shave with minimal skin damage and hence less pain.
A: This is pure speculation.
Removing soap/shaving cream causes sensations that distract from the discomfort of actually shaving. 
Evaporation is separated from the skin by a layer of soap bubbles. Removing the soap occurs during shaving results in evaporation occurring directly on the skin, which produces a cool fresh feeling not unlike the cool side of a pillow. The bubbles themselves exert a clinging force - the release of which likely contributes to the distraction. 
Using soap/water/shaving cream likely does not affect the actual mechanics significantly - besides forcing one to shave slowly. 
