After Lucifer was banished from Heaven for defying God due to his corruption from the Mark of Cain, he twisted a human soul into the first demon. After this, God sent Michael to imprison Lucifer in the Cage which was locked with 600 mystical seals.
In 1972, Azazel possessed a priest at St. Mary's Convent, and killed eight nuns in the chapel. This enabled him to speak to the imprisoned Lucifer, who used the head nun as a conduit. Lucifer tells Azazel that Lilith is needed to break the 66 Seals that hold him captive in the Cage and that he needs to find a very "special child." This leads Azazel to recruit select children, including Sam Winchester and to set in motion events that subsequently lead to the breaking of the 66 Seals.
In 2008, after Dean's return from Hell, Castiel reveals that Lilith is trying to break the seals that lock the Cage in order to free Lucifer. Dean later learns that the first seal was broken when he was in Hell, and broke under torture and began torturing souls himself. Sam continues clandestine missions with Ruby, developing his powers even though this involves drinking demon blood, believing that killing Lilith will stop the Cage being opened. In 2009, Sam unknowingly releases Lucifer from the Cage by killing Lilith at St. Mary's Convent. Lilith is revealed to have been the last of the 66 Seals.
As Sam and Dean attempt to find a way to stop Lucifer and the impending Apocalypse, Gabriel tells them that the Four Horsemen of the Apocalypse all own rings that together can reopen a portal to the Cage anywhere. After collecting all the rings, Sam comes up with a plan in which he will allow Lucifer to possess him, and then force him into the Cage. The initial attempt fails, but when Lucifer confronts Michael at Stull Cemetery, Sam activates the rings and as the Cage opens, he manages to gain enough control to force himself (and Lucifer) into the Cage. Michael (in possession of Adam's body) tries to stop him but is dragged into the Cage as well.
After the averted Apocalypse, Raphael tried to reopen the Cage to release Lucifer and Michael, to continue where the angel's plans left off, but was ultimately unsuccessful due to Castiel leading a civil war in Heaven to stop him. During this time, Sam is subsequently rescued from the Cage by Castiel, but his soul remained trapped in the Cage being tortured by Lucifer and Michael. Death agrees to retrieve Sam's soul, and returns it to his body, setting up a temporary "wall" in Sam's mind to prevent the knowledge of the horrors that happened in the Cage from destroying him.
Following the release of the Darkness, cries are heard coming from the Cage, and the demons speculate that Michael or Lucifer are trying to warn them about it. Sam also starts having flashbacks or visions of his torment in the Cage. When Sam finally journeys to Hell to confront Lucifer with Crowley and Rowena, he learns that the impact of the Darkness' release had a massive effect on Hell, causing the Cage to become damaged. It was through those fissures Lucifer was able reach out and give Sam his visions of the Cage. Lucifer is eventually able to escape in 11.10 The Devil in the Details by taking Castiel as his vessel, leaving Michael, who had become catatonic due to his imprisonment, alone in the Cage.
In 2020, God opens every doorway in Hell to unleash the souls of the damned into the world, including Lucifer's Cage. Eventually, Michael is revealed to have maintained his sanity and escaped from the Cage alongside Adam when it was opened, leaving it empty.
Michael locked Lucifer in the Cage with 600 Seals, of which only 66 of the 600 had to be broken in order for Lucifer to be released. The Cage, according to Castiel, is heavily guarded.
Each of the Four Horsemen of the Apocalypse own individual rings that together form a key-like device that can reopen a portal to the Cage. Death described it as a "fiery pit" and during his time in the Cage, Sam is seen surrounded by eternal flames. 
Communication is possible from the Cage -- Lucifer is able to talk to Azazel, after Azazel performs a specific ritual on Earth that allows Lucifer to speak through a conduit. After the Darkness is released, Crowley's minions report hearing cries coming form the Cage.
Where Is the Cage?
The exact location of the Cage was originally quite vague. It seemed to be of the same realm of Hell, though obviously separate from the part of Hell where demons are produced, as it took great effort for even Azazel to establish communication with Lucifer. Dean is able to open the Cage via the Horseman's rings in a deserted building and Sam uses them to open the Cage in Stull Cemetery. It was conjectured by fans that, since the Cage could be entered from multiple locations, it may exist on a different dimensional plane.
However, Sera Gamble later confirmed that the Cage is, "At the bottom of the lowest depths of the ninth circle of the worst bit of Hell." In season 11, the Cage is finally shown to be a box hanging by multiple chains surrounded by black storm clouds.
4.02 Are You There, God? It's Me, Dean Winchester
Castiel reveals to Dean Winchester that an angel by the name of Lucifer who is confined to a cage, which will open when all of the 66 Seals break.
Dean: Why break the seal anyway?
Castiel: You think of the seals as locks on a door.Castiel: Lucifer walks free.
Dean: Okay, last one opens, and?
– Dean and Castiel, 4.02 Are You There, God? It's Me, Dean Winchester
4.07 It's the Great Pumpkin, Sam Winchester
Castiel explains to Dean that if Lucifer ascends from the Cage, Hell and chaos will follow his presence on Earth. He later elaborates by saying that all of creation will literally experience Hell if [Lucifer roams Earth.]
4.16 On the Head of a Pin
And it is written that the first seal shall be broken when a righteous man sheds blood in Hell. As he breaks, so shall it break.
Castiel and Uriel ask Dean to torture Alastair to find out who is murdering angels. In the process, Alastair revels that it was Dean who broke the first seal of Lucifer's Cage.
4.22 Lucifer Rising
And it is written that the first demon shall be the last seal.
Ruby helps Sam find a demon who can reveal Lilith's location. In preparation for confronting Lilith, Ruby encourages Sam to drink the demon blood (killing the woman it is possessing in the process). At St. Mary's Convent, Sam uses his powers to kill Lilith, only to have Ruby reveal that Lilith is actually the final Seal holding the Cage secure. Lilith’s blood forms a spiral circle in the middle of the chapel at St. Mary's Convent and the gates of Lucifer’s prison open and Lucifer is released into the world.
5.01 Sympathy for the Devil
Following Sam Winchester's actions of killing Lilith the first demon, a direct portal to Lucifer's Cage opens, which releases Lucifer where he ascends from its bowels, soon arriving on Earth. While Lucifer rises from the Cage, his mere essence launches a bright white column of light from the shaft of the Cage.
5.19 Hammer of the Gods
Without me, you got zero shot at killing Lucifer. Sorry. But... you can trap him. The cage you sprung Lucifer from, it's still down there, and maybe, just maybe, you can shove his ass back in. Not that it'll be easy. You got to get the cage open, trick my bro back into it, and oh yeah, avoid Michael and the God Squad. But hey - details, right? And here's the big secret, Lucifer himself doesn't even know. But the key to the cage, it's out there. Actually it's keys, plural, four keys. Well, four rings from the Horsemen. You get 'em all, you got the cage.
Sam and Dean try to kill Lucifer with the Colt but fail, and are desperate for a solution. In a hidden message recorded on a Casa Erotica DVD, Gabriel reveals posthumously how Sam and Dean can trap Lucifer back in the Cage, by using the rings worn by the Four Horsemen of the Apocalypse, which act as keys to the Cage.
5.20 The Devil You Know
Crowley reveals he is aware of Sam and Dean's plan to get the Horsemen's rings to trap Lucifer back in the Cage thanks to his magical coin. He also tells them he wants to help them do it. Sam comes up with a plan -- he could consent to Lucifer's possession, and with much determination he could resist Lucifer for a brief moment; which would give him time to jump into the Cage with Lucifer inside of him. Bobby and Dean are both against the idea.
5.21 Two Minutes to Midnight
Sam and Dean get the final two rings after Castiel cuts off Pestilence's finger using Ruby's knife and Death gives his ring to Dean in exchange for his promise to do whatever it took to free him from Lucifer's control, ensuring that Sam would jump into the Cage as soon as he consented to possession by Lucifer. Death also instructs Dean on how the rings work to open the cage, although the explanation is not shown in this episode. Dean is later shown working with all four rings on a table. They join together to form a triangular shape with War's ring in the center and the other three rings surrounding it. When Bobby asks him about Death teaching him how the rings work, Dean responds, "Yeah, it's nuts."
5.22 Swan Song
Bvtmon Tabges Babalon.
Dean finally agrees to support Sam's plan though he has deep misgivings telling him, "Your Hell is gonna make my tour look like Graceland." Sam primes himself by drinking demon blood and then they confront Lucifer. Lucifer knows of their plan, but Sam says "yes" anyway. As Lucifer takes him over, Dean uses the ring and an incantation to open the "door" to the cage. However Lucifer is in control, and he easily closes it.
Later, in Stull Cemetery, Lucifer faces Michael who appears using Adam Milligan as a vessel. Lucifer tries to dissuade Michael from the fight, blaming their conflict on God, and suggesting they walk away. Michael counters that he must carry out God's orders, and that it's his destiny to kill Lucifer, who is evil. Just then Dean arrives in the Impala, Def Leppard's "Rock of Ages" blaring. Dean tries to talk to Sam, inside Lucifer, but Michael tells him it's not his fight anymore. Castiel arrives and throws a Molotov cocktail made with holy oil at Michael, causing him to vanish temporarily. Lucifer turns and blows Castiel up with a snap of his fingers. Then, as Bobby begins shooting him, he snaps Bobby's neck.
Lucifer starts to beat Dean, taunting him, saying he will kill him slowly and make Sam feel it. Dean doesn't resist, just telling Sam he won't leave him. As Lucifer goes to land another blow, he glances at the Impala, and suddenly all Sam's memories of life with Dean rush at him, allowing Sam to take control over Lucifer. He tosses the Horsemen's rings to the ground and recites the incantation to open the Cage. He and Dean look at each other one last time, but as Sam goes to throw himself in, Michael reappears. Michael tries to stop him, but Sam drags him into the chasm too, and it shuts.
6.01 Exile on Main St.
I don't want to talk about it. I get to breathe fresh air, have a beer, hunt with my family, see you again. So why exactly would I want to think about Hell?
Sam reveals that he escaped the Cage soon after tumbling into it. He tells Dean he remembers his time there, but when Dean asks, he doesn't want to talk about it. Dean speculates that God may have brought him back.
6.03 The Third Man
Raphael intends to release Lucifer and Michael from the Cage through unspecified means to complete the apocalyptic showdown. Prompting Castiel to make a stand, a start a civil war in Heaven.
6.06 You Can't Handle the Truth
Dean tells Bobby that Sam has been different ever since he was released from the Cage. He speculates that Sam may still be a vessel for Lucifer but Castiel denies this, and says that if Lucifer was on Earth, he would've felt his presence.
6.07 Family Matters
Castiel determines that Sam has no soul, and speculates that it was left behind in the Cage with Michael and Lucifer. He tells Dean the Cage is more well-guarded than Dean was when he was in Hell.
6.09 Clap Your Hands If You Believe...
The Leprechaun is able to make deals with humans so that they may fulfill their wishes. Appearing to be very powerful, he employs what he calls "real magic." He claims to be able to lift Sam's soul from Lucifer's Cage, and scoffs when Sam mentions that not even angels could accomplish that saying that fairies, "Got a way of gettin' in back doors."
6.10 Caged Heat
Castiel tells Dean that Sam's soul, having been tortured by Lucifer for over a year, may be irrevocably damaged. Crowley also confirms this.
6.11 Appointment in Samarra
Dean has himself purposefully "killed" under medical supervision, so he can plead with Death to rescue Sam and Adam from the Cage. Death agrees to rescue only one of them -- Dean chooses Sam. Death makes a wager with Dean, that if he will wear Death's ring for one day, and perform his duties, then Death will rescue Sam's soul. He tells Dean that he will be able to contain the part of Sam that will be damaged from his time trapped with Michael and Lucifer behind a "wall" in Sam's mind, although he can't guarantee how long this will maintain. Although Dean fails to wear the ring for a day, Death agrees to retrieve Sam's soul, which he returns to Sam.
6.13 UnforgivenSam starts remembering a portion of events that happened when he lacked a soul. After Sam and Dean resolve the murders, Sam falls onto the floor, shaking uncontrollably, where he recalls some of the torture he endured in Hell by Lucifer, where he is seen covered in flames.
6.14 Mannequin 3: The Reckoning
Sam asks Dean how long he was unconscious while he was experiencing a brief flashback of his time spent in the Cage. Dean tells him it was 2-3 minutes. Sam tells him it felt like a week.
6.22 The Man Who Knew Too Much
After Dean, Sam and Bobby learn from Eleanor Visyak that Castiel has enough information to open a doorway to Purgatory wide open, Castiel appears and asks them to leave, but when Dean refuses, he touches Sam's forehead, cracking the wall that Death planted there in the process.
Immediately after the incident, Sam lies unconscious on a bed in Bobby's Panic Room. Although unbeknownst to him at the time, as he thinks it is all real, Sam is actually going through mental experiences, where he first fights a soulless version of himself, kills it and absorbs its memories, a while later, he confronts a version of himself that recalls all of what happened to him the Cage, this version doesn't fight Sam, but warns him about the cost of remembering before allowing Sam to kill him. As Sam gets flooded with those experiences from the Cage, he is able to wake up. Once awake, he goes to assist Dean and Bobby, and on the way, he has mental visions of Hell, but somehow manages to overcome them.
11.01 Out of the Darkness, Into the Fire
After the Darkness was released, an animalistic scream was said to have been heard originating from the Cage. As was reported to Crowley, at least half of Hell shows concern that either Michael or Lucifer were trying to warn everyone of the coming of the Darkness.
11.02 Form and Void
Sam has a vision of when he was tortured in the Cage, with hooks in his flesh being pulled apart by chains.
11.06 Our Little World
Sam has another vision or flashback of Lucifer's Cage.
11.09 O Brother Where Art Thou?
Sam has yet another vision of being in the Cage, this time he is face to face with Lucifer who simply places his hand on Sam's cheek. Sam and Dean summon Crowley about gaining access to the Cage, when he says he is incapable of opening it, as the Cage is of "divine manufacture," he does tell them of a possible way speak with Lucifer without opening the Cage, which involves the information being recorded in one place: the Book of the Damned.
Having captured Rowena; Sam, Dean and Crowley make a deal with her -- she figures out a way to communicate with Lucifer without opening the Cage, and Crowley will call off his assassins. Having studied the Book of the Damned, Rowena finds a spell that will work for what they need. Sam, Rowena and Crowley gather the ingredients needed and descend to the furthest reaches of Hell -- Limbo, where they will perform the spell to allowing communication with Lucifer in relative safety.
11.10 The Devil in the Details
11.11 Into the Mystic
11.14 The Vessel
Sam and Dean still believed that Lucifer is still in the cage until he reveals himself to be possessing Castiel.
11.18 Hell's Angel
Crowley offers to give Sam and Dean the Horn of Joshua in exchange for exorcising Lucifer from Castiel's vessel and sending him back to the cage, but Sam says that the cage is damn near impenetrable as it took Rowena and a spell from the Book of the Damned to summon him and inadvertently release him. Even though he tells the Winchesters that Rowena was killed and that she hid the book, Crowley is adamant in sending him back to the cage. They say that Lucifer may be their only hope in killing the Darkness if he has the Horn of Joshua.
11.21 All in the Family
Chuck tells Sam and Dean that he doesn't trust that Lucifer would help them against Amara because of his time imprisoned in the cage. Later, when Lucifer and Chuck agree to talk, Lucifer accuses him of throwing him into the cage because of what the Mark did to him, but Chuck says that he did what he had to do to keep mankind safe. When Chuck asks him what he would have done, Lucifer says it doesn't matter as he still forsook him, despite being his son.
After getting a Hyperbolic Pulse Generator from Arthur Ketch of the British Men of Letters, the Winchesters, Castiel, Crowley and Rowena team up together to return Lucifer to his cage. Using President Jefferson Rooney/Lucifer's mistress Kelly Kline, the group lures Lucifer to a motel where Sam uses the Hyperbolic Pulse Generator, a device capable of expelling a demon from their vessel. The powerful pulse beats Lucifer back, as Rowena casts a spell to send Lucifer's essence back to the Cage. After exchanging words with Sam, Lucifer vacates the president's body, his essence swirls below the ceiling before going through a heating vent in the floor.
12.13 Family Feud
Crowley reveals that he perverted Rowena's spell to send his essence back to his discarded vessel Nick rather than being sent back to the cage. Crowley had a dozen of his most loyal demons study the cage at the molecular level and replicate the material used in creating the chains that bind him.
12.15 Somewhere Between Heaven and Hell
When Lucifer escapes his chains and tries to kill Crowley, he reveals that he also had the runes and spellwork from the cage carved into every molecule of his vessel, allowing him to negate Lucifer's powers and effectively torture him.
13.02 The Rising Son
Drexel says that he and the demons have been searching for Lucifer, even checking the cage, and yielding no results.
Castiel meets with a demon to visit the cage and study it, but she is uncooperative. When Chuck gives Sam and Dean The Equalizer to kill Jack, Castiel suggests throwing him in the cage until they find a way to save Jack, but Dean, who is too stubborn to care, shoots down the idea.
15.01 Back and to the Future
Belphegor tells Dean that every door in Hell sprang open all at once when God started the end of the world. Dean realizes that this means Lucifer's Cage as well and asks about Michael. Belphegor tells Dean that the last he heard, Michael was still just sitting in the Cage, but suggests that if Michael got out he might hold a grudge against the Winchesters.
15.08 Our Father, Who Aren't in Heaven
After realizing that Michael might know something that could help them beat God, the Winchesters and Castiel use one of Rowena's spells to travel into Hell to talk to the archangel in the Cage. After interrupting a brawl between the three and several demons, Rowena, now the Queen of Hell, reminds them that the Cage is open and Michael could be anywhere in Hell or on Earth. However, Rowena has her demons search Hell for Michael when they impress upon her the urgency of the situation. The demons subsequently report back that Michael is gone, having escaped from both the Cage and Hell.
Following his escape, Michael continues to use Adam Milligan, who he took out of the Cage with him, as Michael's vessel on Earth. During their years together in the Cage, Michael and Adam were able to reach an understanding since all they had was each other and now share control of Adam's body and even appear to have developed a friendship. After being captured by the Winchesters and Castiel, Michael is angry at Sam and Castiel for their roles in trapping him in the Cage and at Dean for abandoning Adam there while letting Lucifer free upon the world. Adam, while arguing with Michael, reminds the archangel that God abandoned Michael in the Cage as proof that they are right about God. Dean later apologizes to Adam for allowing Adam to get trapped in Lucifer's Cage, stating that Adam is a good man and didn't deserve that fate.