How to tell whether lone pairs in heterocycles contribute to aromaticity?
For the most common situations use this rule: a conjugated ring atom needs either a ligand or a localized electron pair to replace a missing ligand.  Any remaining electron pairs are then part of the conjugated pi system.

Thus pyridine needs a localized lone pair on nitrogen to replace a missing ligand, and that leaves only three bonding pairs for the pi system.  Pyrrole has a ligand on nitrogen so the lone pair is conjugated into the pi system along with two carbon-carbon bonds.  Furan has two lone pairs on oxygen but a missing ligand, therefore oxygen contributes one pair to the pi system.