The Rains of Castamere is a song in Game of Thrones. When it starts playing, you'd best run because it means the Lannisters are about to do some ruthless killing. The Rains of Castamere was played during the Red Wedding, which was one of the most shocking events in the entire series.
George R. R. Martin's main inspiration for this is the Second Barons' War, a civil war in England during 1264-1267 between Simon de Montfort, the 6th Earl of Leicester, and Edward I, the son of Henry III. Tywin Lannister is thought to be inspired by Edward I in many aspects. Simon de Montfort, who could also be the main inspiration for the rebel lord of House Reyne of Castamere. They have a lot of similarities and differences. They are both renowned for almost exactly in the same manner; familial history, a hellbent desire for maintaining their family legacy, characteristic similarities, feared by the small folk, they both had sons whom they groomed but their sons failed to live up to expectations despite godgiven talents, they also quashed rebellions while being ruthlessly efficient, etc.
Now, Edward I had an ineffectual father who had a heart of dough, Henry III, so Edward I took it upon himself to rally soldiers and quash a rebellion led by Simon de Montfort. Simon de Montfort eventually succumbed to the might of Edward I and fell during the Battle of Evesham in 1264. Subsequently, Simon de Monfort's remains were mutilated.
Compared to the Game of Thrones version,
Lord Tytos Lannister, Tywin's father, was considered a very weak liege lord. Weak enough that his vassals mocked him over their drinks, and laughed at him openly. Just like Edward I, Lord Tywin took it upon himself to squash a rebellion.
One of the powerful houses under the Lannisters were the Tarbecks, and at one point Tytos had Lord Tarbeck arrested. In retaliation, Lady Tarbeck arrested three Lannisters and demanded the safe return of her husband. Tywin suggested sending Lord Tarbeck back as three pieces - one for each captured Lannister. Tytos however, sent him back in one piece as part of the hostage exchange.
A few years later, the most powerful vassal house of the Lannisters, the House Reyne of Castamere, under their lord who was called The Red Lion joined forces with Lord Tarbeck and rebelled against the Lannisters. House Lannister was pretty much lost with no proper leader, until Tywin stepped up. He quashed the rebellion, turned the castles at Castamere and Tarbeck Hall to ruin, and killed every single Reyne and Tarbeck. The two houses were killed, their bodies were mutilated, and the dead were hung as a reminder for the duration of the summer. The whole event was made into a song called The Rains of Castamere. The title is thus a play on words. As the "rains" fall over the empty halls of the "Reynes" who have been killed to the last man.
Tywin got a fierce reputation after that, and it was the main reason that the Mad King appointed him as Hand. On another occasion, Tywin sends a singer with a flute to Lord Farman of Faircastle to play the song for him, just to keep him in place. Tywin's reputation became so fierce that just playing this song brought fear and kept people in their place.
What the lyrics mean
The Reyne's also had a lion on their sigil, theirs was red. The Lannisters is gold. That's what the lyrics "only a cat of a different coat that's the truth I know, In a coat of gold or a coat of red, a lion still has claws, And mine are long and sharp" mean.
House Reyne was an ally to the Lannisters but they were also rich and powerful. The Lord of Castamere asserted his power and equality to the Lannisters in the song by saying, "And who are you, the proud lord said, that I must bow so low."
The song goes on saying that House Reyne begged for their lives but Tywin killed everyone so no one could hear their screams. 'And so he spoke, and so he spoke, that lord of Castamere, But now the rains weep o'er his hall, with no one there to hear. Yes now the rains weep o'er his hall, and not a soul to hear'.
House Sigil is similar to Simon de Monfort, a rebel lord that raised against Edward I "Longshanks", the king of England. Edward I finally crushed House Monfort. So it's clear that Tywin is linked to Edward I and Lord Reyne to Monfort. If you remember, Cersei explains this event to Margaery before Sansa and Tyrion's wedding. This song is regarded to refer to the Lannister House in general. It's like a battle cry. We will probably hear it quite a lot in the coming season as Cersei asserts her power. There's many different covers of this song. I like the one by Jackie Evancho because it sounds creepy and I love it. After what the Frey's and the Lannisters did to Robb Stark, I want every one of them dead and baked into a pie. Except Tyrion and Jaime of course.