Why and how does carbon hybridize itself according to its need?
Hybridization is part of the language chemists use to speak to one another.  When someone says that a carbon atom is $\ce{sp^2}$ hybridized, it's a shorthand way of telling others 


that there is a p-orbital on that carbon
that the angles around the carbon are roughly 120°
that the bonding orbitals (the $\ce{s^1p^2}$ orbitals) have 1 part in 3, or 33%, s-character and 2 parts in 3, or 67%, p-character
that the bonds around that carbon are likely to be a bit shorter than the bonds around an $\ce{sp^3}$ hybridized carbon (because the $\ce{sp^2}$ bonds have more s-character and are therefore closer to the nucleus, e.g. shorter).


So when someone says that a carbon atom is $\ce{sp^2}$ hybridized, they're really saying a lot more.

Using hybridization to describe an atom is similar to using VSEPR or MO theory to describe a molecule.  Hybridization is just another way to try and describe reality; just like the other methods, often it works well, but sometimes it doesn't.

Also keep in mind that there is a continuum of hybridizations available to a molecule all the way from pure s to pure p with everything else in between.

$\ce{s^1p^0...s^1p^1...s^1p^2...s^1p^{2.2}...s^1p^3...s^1p^4...s^0p^1}$

Of course, we normally drop the "1" and the "0" superscripts and write those hybridizations as

$\ce{s...sp...sp^2...sp^{2.2}...sp^3...sp^4...p}$

As to how carbon (or any other element) "decides" which hybrization to use, it adopts the hybridization that produces the overall lowest energy for the molecule. Let's take the case of a carbocation.  Suppose we start with an $\ce{sp^3}$ hybridized carbon in a molecule like $\ce{R_3C-I}$ and subject it to conditions where it ionizes to an $\ce{sp^2}$ hybridized carbocation and $\ce{I-}$.



(image source)

Your question is basically, why did the central carbon rehybridize from $\ce{sp^3}$ to $\ce{sp^2}$? The answer is, the ionized molecule (the carbocation) will reoptimize its geometry (rehybridize) in order to attain the lowest energy possible. In this example note that the carbocation p-orbital is empty - it contains no electrons. So why keep that orbital $\ce{sp^3}$ hybridized, why waste a part of a valuable, low-energy s-orbital in a bond with no electrons in it to stabilize? Instead, why not remove the s-character from the $\ce{sp^3}$ bond making it a pure p-orbital and mix that s-character into the other 3 orbitals (or bonds) to convert them from $\ce{sp^3}$ to $\ce{sp^2}$ thereby lowering the energies of the electrons that are in those 3 bonds. In fact, this rehybridization, or geometry reoptimization, is exactly what does occur in this reaction in order to stabilize the electrons as much as possible and produce a molecule (or ion) with the lowest possible energy.