Dear Navi:
You wrote:
The war taught us how to survive, and it was worth it. What do the two its stand for? What does the sentence mean?
This is a very good question. There are two things going on in this sentence, both are idioms.
The first it is usually seen as referring to the previous sentence—in this case the lesson learned from the war. It is not referring to just a single noun, like war, but rather the whole clause, that is, the experience of survival. English often uses it that way when there is an expression of value. Sometimes, of course, it can be completely idiomatic as in “it is raining.” Pronouns are used that way in many of the European languages, not just English.
“Worth it” is also an idiomatic expression. Most literally “worth it” refers to the price of something. It means “worth the price.” Usually it suggests something that appears to have a high price but is a good value nevertheless. “The extra cost for flood insurance was worth it. We would not have been able to pay for the restoration of our basement after the hurricane if we did not have that insurance.”
But many times “worth it” can refer to an experience—usually one considered difficult or costly in some way. That is what the person is saying here. “Surviving the war was difficult, but the lessons we learned from our survival experience were quite valuable. They were worth the price we paid.”
I hope this helps. (I could even say to myself—“I hope my explanation was worth it!”)