A carbocation is a reactive intermediate with only 6 valence electrons from the usual 8 electrons for carbon by covalent bonding. This makes the carbon atom bear a positive charge and possess three bonds instead of four.

Two common routes can form a carbocation:
Heterolytic bond cleavage
Addition of carbocation to an unsaturated system
1) Heterolytic bond cleavage
In heterolytic bond cleavage, the two electrons covalent bond joining two atoms breaks unequally. The more electronegative atom takes the bond electrons to become an anion (negatively charged) or a neutral molecule, leaving the other atom as an electron-deficient carbocation (positively charged).

Such heterolytic bond cleavages generating carbocations are part of several organic reactions. For example, the displacement reactions (SN1) and alkene formation reactions (elimination reaction, E1) go through the carbocation intermediate step.
Some structural features stabilize the carbocation allowing for easy heterolytic bond cleavage. For example, a good leaving group on a tertiary butyl carbon favors carbocation formation.
The leaving group (an atom or a group of atoms) detaches from the main molecule with the bond electrons and is stable. The alkyl substituents also stabilize the carbocation formed by donating their electron density (+I and hyperconjugative stability).

The stability of both the leaving group and the carbocation is essential for heterolytic bond cleavage reactions.
2) Addition of carbocation to unsaturated system
An electrophile (E+) or a proton (H+) adds to one of the two atoms of a double bond leading to the adjacent carbon atom becoming a carbocation.
Such additions of an electrophile and subsequent carbocation formation are seen in benzenes and alkenes. The benzene or an alkene is an electron-rich system that attracts the electron-deficient electrophile to form a new covalent bond.
Since the pie bond is shared between two atoms and a covalent bond form on only one atom, the adjacent atom becomes electron deficient, forming a carbocation.

The electrophilic addition reaction on alkene and aromatic electrophilic substitution reactions on the benzene follow this method.

This excerpt is inspired by the chapter Reactive Intermediates, part of CurlyArrows' Introductory Organic Chemistry Course. Preview the Book.
Related Reading
Difference Between Carbocation and Carbanion
Difference Between Carbocation and Electrophile
Role of a Carbocation in a Reaction