Self righteousness is usually something that creeps up on us. It occurs when we believe that we deserve something ... maybe just respect. But self righteousness is a dangerous tool. It usually leads to pride, causes us to not really love others and most of all - it prevents us from learning anything from God.
Self righteousness comes about when I am focused on how right I am (or how wrong you are). But it is blinding. How right I am is rarely the point.