Leviticus 16: The scapegoat is just one part of the ceremony on the Day of Atonement when the priest goes into the holy of holies to make an atonement for the children of Israel for all their sins once a year.
Aaron shall take of the congregation of the children of Israel two kids of the goats for a sin offering. (vs 5)
Aaron shall take the two goats and present them before the Lord at the door of the tabernacle of the congregation. He shall cast lots for the two goats; one lot for the Lord and the other lot for the scapegoat.
He shall bring the goat on which the Lord’s lot fell and offer him for a sin offering. But the goat, on which the lot fell to be the scapegoat, shall be presented alive before the Lord, to make an atonement with him, and to let him go for a scapegoat into the wilderness. (vs 8-10)
Aaron shall kill the goat of the sin offering, that is for the people, and bring his blood within the veil… and sprinkle it on the mercy seat and before the mercy seat:
He shall make an atonement for the transgressions of the children of Israel …
When Aaron goes in to make an atonement in the holy place, no man shall be in the tabernacle of the congregation, until he comes out.
He shall go out to the altar that is before the Lord… And he shall sprinkle of the blood of the goat (and a bullock) with his finger seven times, and cleanse it, and hallow it from the uncleanness of the children of Israel.
When he has finished reconciling the holy place, the tabernacle of the congregation and the altar, he shall bring the live goat and shall lay both his hands on the head of the live goat, and confess over him all the iniquities of the children of Israel, and all their transgressions in all their sins, putting them on the head of the goat, and shall send the scapegoat away by the hand of a fit man into the wilderness. The man shall let the goat go in the wilderness, and the goat shall carry all their iniquities to a land not inhabited. (vs 15-22)
He that let the goat go for the scapegoat shall wash his clothes and bathe his flesh in water, and afterwards he shall come into the camp.
The goat killed for the sin offering shall be carried outside the camp and the skin, and the flesh, and the dung shall be burned in the fire. And he that burns them shall wash his clothes, and bathe his flesh in water, and afterward he shall come into the camp. (vs 26-28)