This question already has an answer here:
How can I decide whether lone pair electrons take part in the continuous overlap of electron or not?
For example, the lone pair in pyridine is not a part of the conjugated system, whereas the lone pair in pyrrole is.
I had read that this was due to the lone pair in pyridine being localised in an sp2 orbital, while the lone pair in pyrrole is delocalised.
How do we identify this?