There are three types of excommunication pronounced by the Catholic Church - minor excommunication (normally applied to a Catholic who communicates with someone under the ban of excommunication), major excommunication (pronounced as part of a sentence for minor crimes against the church), and anathema. Anathema is pronounced by the Pope for high crimes against the church. The ceremony for pronouncing anathema is what most people picture when they hear about the ceremony of excomminucation. Of note is the fact that this is not a formal sacrament or rite of the Catholic Church.

The ceremony is led by the Pontiff, attired in amice, stole, violet copse, and mitre. Attended by 12 priests bearing lit candles (one of whom also bears a bell), the pope enters bearing the Bible and another lit candle. He then pronounces the following:

Wherefore in the name of God the All-powerful, Father, Son, and Holy Ghost, of the Blessed Peter, Prince of the Apostles, and of all the saints, in virtue of the power which has been given us in binding and loosing in Heaven and on earth, we deprive N himself and all his accomplices and all his abettors of the Communion of the Body and Blood of Our Lord, we separate him from the society of all Christians, we exclude him from the bosom of our Holy Mother the Church in Heaven and on earth, we declare him excommunicated and anathemized and we judge him condemned to eternal fire with Satan and all his angels and all the reprobate, so long as he will not burst the fetters of the demon, do penance and satisfy the Church; we deliver him to Satan to mortify his body, that his soul may be saved on the day of judgement.
At this point, the Pontiff slams the Bible closed, the priest rings the bell once in mourning for the damned soul, and the Pontiff and all attending priests turn their candles upside-down and dash them out upon the ground.

The ceremony, despite common interpretation, doesn't actually remove the offender from the Catholic Church. The intention is to bar them from the benefits of Catholicism until they repent. The position of the Catholic Church is once a Catholic, always a Catholic.