Upvote:1
In general, such matters are governed by canon law. You can find that in the Vatican's Code of Canon Law
Book VI, Part I deals with penalties in general while Part II delves into individual delicts.
In Canon 1331, you can find what an excommunication actually is:
Can. 1331 §1. An excommunicated person is forbidden:
1/ to have any ministerial participation in celebrating the sacrifice of the Eucharist or any other ceremonies of worship whatsoever;
2/ to celebrate the sacraments or sacramentals and to receive the sacraments;
3/ to exercise any ecclesiastical offices, ministries, or functions whatsoever or to place acts of governance.
§2. If the excommunication has been imposed or declared, the offender:
1/ who wishes to act against the prescript of §1, n. 1 must be prevented from doing so, or the liturgical action must be stopped unless a grave cause precludes this;
2/ invalidly places acts of governance which are illicit according to the norm of §1, n. 3;
3/ is forbidden to benefit from privileges previously granted;
4/ cannot acquire validly a dignity, office, or other function in the Church;
5/ does not appropriate the benefits of a dignity, office, any function, or pension, which the offender has in the Church.
Bishops do not have a special arrangement under the law, but they could be regarded as a bit more “high risk” for a specific delict that automatically results in excommunication; you can find in Canon 1364:
Can. 1364 §1. Without prejudice to the prescript of can. 194, §1, n. 2, an apostate from the faith, a heretic, or a schismatic incurs a latae sententiae excommunication; in addition, a cleric can be punished with the penalties mentioned in can. 1336, §1, nn. 1, 2, and 3.
Bishops have a position to teach their flock. This teaching may in some cases (not too often, luckily) become heretic or schismatic, with the mentioned result. The term “latae sententiae” means that the punishment is inflicted ipso facto, by the act itself. So as soon as you act as described in Canon 1364 you are excommunicated. No pope is needed to impose the penalty.