There’s excommunication of the formal type, and then there’s "self-excommunication:
1) What could you do to get excommunicated?
Officially: EXTREMELY GRAVE and persistant public sin, heresy, blasphemy, especially leading OTHERS into sin as well.
Self-Excommunication: EXTREMELY GRAVE sin, public or private, such as having an abortion
2) Getting UN-excommunicated:
Confession and talk to the local bishop would be the best start. Excommunication is the purview of the church and so there is no set policy. An excommunicated king in the middle ages was rumored to have stood outside the vatican clothed as a beggar asking forgiveness for a week before he was forgiven. Obviously, that is not the case today. and getting un-“Self Excommunicated” is even less difficult a process.
3) Age you can be excommunicated:
any, past the age of reason (generally considered 7 years old by tradition in the church)
4) What happens to the excommunicated?
They cannot take communion or participate in the sacraments or the mass of the church. In old days, being excommunicated often was like a scarlett letter, but today that is not so. HOWEVER, due to the grave nature of sin required to BE excommunicated, it is reasonable to presume that those who die in that state have a good possibility of earning a one way trip to a very hot place.