I know that in p-type semiconductors there are holes i.e the absence of electrons. What I can not understand is why electron from neighboring atom tends to fill that hole leaving a hole behind itself? I mean what makes that electron to leave its particular atom?
Because a covalent bond lowers energy.
Let us say there is an As and an adjacent Si. One filled hybridized orbital of Si and one empty hybridized orbital of As form a covalent bond, and still they each has a vacancy. A wandering electron fills the holes so that another covalent bond is formed, lowering the energy. In statistical perspective, states of lower energy will dominate in long term.
The filling of holes in acceptor material (and subsequent stripping of electrons in donor material) will stop when the electrostatic force pull them back, that is, the lowering of energy is cancelled by enhanced energy by electrostatic force.
First, let's try to understand about electrons it will help us to understand about holes.The picture you often see of electrons as small objects circling a nucleus in well defined "orbits" is actually quite wrong. As we now understand it, the electrons aren't really at any one place at any time at all. Instead, they exist as a sort of cloud. The cloud can compress to a very small space briefly if you probe it in the right way, but before that, it really acts like a spread-out cloud. For example, the electron in a hydrogen atom likes to occupy a spherical volume surrounding the proton. If you think of the proton as the size of a grain of salt, then the electron cloud would have about a ten-foot radius. If you probe, you'll probably find the electron somewhere in that region.
The weird thing about that cloud is that its spread in space is related to the spread of possible momenta (or velocities) of the electron. So here's the key point, which we won't pretend to explain here. The more squashed in the cloud gets, the more spread-out the range of momenta has to get. That's called Heisenberg's uncertainty principle. It could quit moving if it spread out more, but that would mean not being as near the nucleus, and having higher potential energy. Big momenta mean big kinetic energies. So the cloud can lower its potential energy by squishing in closer to the nucleus, but when it squishes in too far its kinetic energy goes up more than its potential energy goes down. So it settles at a happy medium, with the lowest possible energy, and that gives the cloud and thus the atom its size. It lowers the average energy of the system.