The phrase "bell, book, and candle" refers to a Latin Christian method of excommunication by anathema, imposed on a person who had committed an exceptionally grievous sin.
The ceremony traditionally involved a bishop, with 12 priests bearing candles, and would solemnly be pronounced in some suitably conspicuous place.
The bishop would then pronounce the formula of the anathema, which ends with the following words: Idcirco eum cum universis complicibus, fautoribusque suis, judicio Dei omnipotentis Patris, et Filii, et Spiritus Sancti, et beati Petri principis Apostolorum, et omnium Sanctorum, necnon et mediocritatis nostrae auctoritate, et potestate ligandi et solvendi in coelo et in terra nobis divinitus collata, a pretiosi Corporis et Sanguinis Domini perceptione, et a societate omnium Christianorum separamus, et a liminibus sanctae matris Ecclesiae in coelo et in terra excludimus, et excommunicatum et anathematizatum esse decernimus; et damnatum cum diabolo, et angelis ejus, et omnibus reprobis in ignem aeternum judicamus; donec a diaboli laqueis resipiscat, et ad emendationem, et poenitentiam redeat, et Ecclesiae Dei, quam laesit, satisfaciat, tradentes eum satanae in interitum carnis, ut spiritus ejus salvus fiat in die judicii.
[2]In English: 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 of binding and loosing in Heaven and on earth, we deprive him 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 anathematized and we judge him condemned to eternal fire with Satan and 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 judgment.
The bishop would then ring a bell, close a holy book, and he and the assisting priests would snuff out their candles by dashing them to the ground.