If you, yourself, don't feel good about yourself, you will tend to try to do things that do make you feel better. One way to do that is to make other people feel bad.
If you don't feel like you're good enough, that means that you think other people are better than you. So you have two ways to go at that point. You can either make yourself better or you can tear other people down. If you can tear other people down (by making fun of them or otherwise hurting them) you will look better in comparison to them.
So, people with low self-esteem sometimes shame others because it makes them feel better in comparison to those other people.
The above answer is good one. A person usually seeks to shame another to make himself or herself feel better. By bringing a person down, a person with self-esteem issues feels better in a twisted way. That said, I will add a social dimension.
Why does a person have low self-esteem? Usually a person has low self-esteem, because he or she does not have certain qualities that he or she deems society values. So, if a society prizes wealth or beauty and a person feels as though he or she lack in this department, then this person will have low self-esteem.
If we build on this premise, we can say that shame also has a social function as well. For shame to work, person must feel the displeasure of society. So, a person with self-esteem issues may seek to bring another person down not to to make himself or herself feel better, but to have another person who is outside of society. In short, misery loves company.