Count the number of pi electrons. If the lone pair would satisfy Huckel's rule (4n+2) and make, say, 6 pi electrons, then it does contribute to the aromaticity of the N ring. However, if there already exists 6 pi electrons without the N lone pair, then the electrons do not contribute to the aromaticity, and the N can be used as a Lewis base (free electron pair).
this isn't quite correct though. you can't just choose to count the lone pair if it helps you satisfy Huckel's rule, or to not count it if it doesn't help. (look at cyclobutadiene, and replace one of the carbons with a nitrogen. it's still antiaromatic, even though you could count the lone pair and say it's aromatic)
Basically, you count the lone pair if it extends perpendicular to the plane of the ring. This way it can participate in the resonance delocalization of the rest of the pi electrons.
Soooo, the way I teach it is this:
When deciding whether or not to count heteroatom lone pairs as pi electrons:
Case I: The heteroatom has one lone pair:
1. Is the heteroatom double bonded to any other atom? If so, then don't count the lone pair as pi electrons.
2. If not, count the lone pair as two pi electrons.
Case II: The heteroatom has two lone pairs (this generally applies to oxygen and sulfur):
1. Count only ONE of the two lone pairs as two pi electrons.
This way applies very broadly. Like I said, it's all because the lone pair extends perpendicular to the plane of the ring. When you have only one lone pair, if there heteroatom is double bonded to another atom, then if you draw out the geometry, you find that the only place you can put the lone pair is IN the plane of the ring, so it can't participate in the fully conjugated system. Instead, the two electrons in the double bond are perpendicular to the plane and are counted. If there is no double bond, then when you draw out the geometry you are forced to put the lone pair perpendicular to the ring so it does count.
If there are two lone pairs, obviously they both can't be perpendicular, so one is perpendicular, the other is parallel, and so you only count the perpendicular one.