A simple explanation of Revelation 12 (there are more complex explanations involving the Church, Papacy and the Roman empire, which I find less convincing), Revelation 12 (WEB):
(1) A great sign was seen in heaven: a woman clothed with the sun, and the moon under her feet, and on her head a crown of twelve stars.
The woman is symbolic of Israel. Refer back to Joseph's second dream, Genesis 37:9-10 (WEB):
(9) He dreamed yet another dream, and told it to his brothers, and said, “Behold, I have dreamed yet another dream: and behold, the sun and the moon and eleven stars bowed down to me.”
(10) He told it to his father and to his brothers. His father rebuked him, and said to him, “What is this dream that you have dreamed? Will I and your mother and your brothers indeed come to bow ourselves down to you to the earth?”
So the 12 stars represented the 12 tribes of Israel, and the sun and the moon represented Israel (Jacob) and his wife (Rachel). The woman in Revelation 12 is therefore symbolic of the nation of Israel.
Rev 12 (WEB):
(5) She gave birth to a son, a male child, who is to rule all the nations with a rod of iron. Her child was caught up to God, and to his throne.
The male child (of the nation of Israel) is clearly referring to the Messiah Jesus, who will during the Millennial Age rule the nations strictly, with a rod of iron, and who after his resurrection was taken up into heaven to sit at the right hand of God ("looking to Jesus, the author and perfecter of faith, who for the joy that was set before him endured the cross, despising its shame, and has sat down at the right hand of the throne of God", Hebrews 12:2).
(6) The woman fled into the wilderness, where she has a place prepared by God, that there they may nourish her one thousand two hundred sixty days.
The nation of Israel shortly afterwards is scattered amongst the Gentile nations.
(13) When the dragon saw that he was thrown down to the earth, he persecuted the woman who gave birth to the male child.
The dragon, symbolic of Satan, has been persecuting the nation of Israel ever since.
(17) The dragon grew angry with the woman, and went away to make war with the rest of her offspring, who keep God’s commandments and hold Jesus’ testimony.
Satan has also been persecuting Christians, the offspring of Israel (Jesus was one offspring, Christians are the rest of the offspring).