The indole presents an acidic hydrogen on the nitrogen atom, with pKa= 17. Using strong bases it can be deprotonated, forming the indolium anion.

indole acidity 01

Reaction of indolium with different electrophiles:

indole acidity 02

The bases that release lithium or magnesium cations into the medium (organolytic and magnesium) block the free pair of nitrogen, producing the attack through the ring.

indole acidity 03

As can be seen in the previous example, the indole with the blocked nitrogen pair attacks through its 3 position, it is an electrophilic substitution.

indole acidity 04

The 1-substituted indoles have acidic hydrogens in position 2, which we can remove using strong bases (organolitics).

indole acidity 05

An acid hydrolysis step protonates the carboxylate.

In case of having acidic hydrogen on nitrogen, it is necessary to remove it, stabilizing the base with phenylsulfenyl chloride, to subsequently remove the hydrogen from position 2.
indole acidity 06