In the Islamic lunar calendar there are four Haraam months (Muharram, Rajab, Dhu al-Qa'dah and Dhu al-Hijjah) and it's been Haraam for Arab tribes to fight against each other in these four months.
So if two Arab tribes were in a battle, at the beginning of these months they would have suspended the war and raise a red flag on the dome of the commander's marquee to show that:
"Although they're not in a war right now but they will resume the war after the Haram month."
We all know that Imam Hussain (AS) was unjustly martyred in Muharram and the red flag still being there means we, Shia Muslims, know that the battle has not finished yet and we are waiting for our Imam Mahdi (aj) to come and resume the war against all those who have oppressed ahlulBayt (AS).
It was also an Arab tradition to raise a red flag on the tomb of the one who had been killed unjustly, until his death is revenged.
As I mentioned above Shia Muslims believe that when Imam Mahdi (aj) comes, he will get this revenge insha'Allah.