A carbanion is an anion in which carbon has an unshared pair of electrons and bears a negative charge usually with three substituents and a total of eight valence electrons.
A carbocation is an ion with a positively-charged carbon atom with a "sextet", i.e. it has only six electrons in its outer valence shell instead of the eight valence electrons.
To identify the reactions involved, first of all learn the methods of generation of carbocations and carbanions. Once you know what reagent generates which species, you will get to know which ion is involved in the given
reaction.