The reaction of halogenated heterocycles with lithium organometallics produces the exchange of halogen for the metal, generating a new organometallic that allows attacking a wide variety of electrophiles.
In the case of pyrrole the reaction is not possible due to the acidic hydrogen, but it can be carried out in 1-substituted pyrroles.
The lithiation requires low temperature to avoid the change of position of the organolithic, in addition it requires 2 equivalents of organometallic.