Many who are excommunicated feel that the church has rejected them as a person. Sadly some members seem to take this stance to re-affirm that idea - treating those excommunicated as second-class citizens. How should members see excommunication? And How should those excommunicated see it? To this there is an outward aspect before the world, and an inward aspect to assist the excommunicated member.
The outward aspect _ It can be said that the church is here to represent Jesus Christ. It also represents the members (thus the name of the church). If someone seriously misrepresents both of these then the church may feel obligated, in reverence to Christ and other members, to demonstrate that the person doesn't represent them, until change is clearly demonstrated.
The Inward Aspect _ Excommunication generally comes because a member has committed a sin that requires special work on their part to feel right with God about afterward. With many sins we can feel good once we have repented and sought God's forgiveness. But some things we do make us feel so bad about ourselves that we need to do what could be termed as "penance", so that we can feel right again. This can be a long process. The church provides an opportunity to make this a more effective and quicker process. This is excommunication.
Also when a person commits such a sin the Holy Ghost withdraws from them for a time. It is no longer a constant companion, because the person has cut off communication by their act. They feel unable to stand in God's presence, so to speak, within themselves. There is a feeling of being dirty. But the Holy Ghost can come back as the person works toward change and clearing out that feeling. So when the stake president declares a person excommunicated he is really only declaring something that has already happened anyway. He has the authority to withdraw the priesthood, as that is an authority within his area of responsibility. He can restore this authority at some point after re-baptism.
Some may question, what of where a person has been found guilty by a church court and later been proven innocent? Fortunately I think these things aren't the usual. Unfortunately prejudice etc may blind the revelatory ability of those who may otherwise be inspired. D&C 121:34-40 warns that this sort of thing can occur with church leaders. And those excommunicated members that are in this circumstance may be concerned about their standing with God. As I mentioned before it is the sin itself that removes the Holy Ghost from you. If the sin didn't occur then you will still have him with you as much as before. Your standing with God will not have diminished one iota. It is him that you will stand before at the judgement, and he judges by the heart, not after the hearing of the ears or the seeing of the eyes (Isa 11:3). Continue to support his church and those appointed to positions, regardless of their faults. It is about you and God, not you and people.To members generally I would say to realise that 1. You most likely don't really know that the person committed the offence. And 2. Even if the person did, you have sinned often enough yourself, so don't be high and mighty.
For those in this position I would just reiterate that excommunication is a helping process not a condemnation. Welcome the opportunity it creates for you and use it.