Your question starts with a simple misconception, but to explain the whole example sentence you gave, one could write an article about it. Before we could discuss the es, we had to discuss the finite verb form blieben:
Es blieben nur noch 18 Monate (übrig), um das Klima zu retten.
(I added that (übrig) — remaining for reasons explained below.)
The word blieben is no way an infinitive. In contrary, it's a finite verb form. Please remember the finite plural forms of German verbs have the same ending as the infinitive. So, how do you tell those two apart?
Check the clauses. The second clause is an um-zu infinitive clause, and this means the first clause must be the main clause of this sentence. Before assuming anything else, assume it's a declarative main clause. This means the finite verb must be the second item (V2 rule). Not the second word neccessarily, but the second item. This is the most strict word order rule in German.
So, what do we have here:
- Es — dummy subject
- blieben — finite verb
- nur noch 18 Monate — subject
- (übrig) — predicative / separable verb prefix
The word blieben must be a finite verb form. The ending -en is plural, and the stem seems to be something with blieb. So let's look up blieben in the dictionary:
Huh? Well, that means you encountered a strong verb which has an ablaut in its non-present forms. The vowel ie (a long i) is a typical ablaut of the diphthong ei, so let's check bleiben instead.
- Yes, there is a verb bleiben. It means to stay, to remain. That second meaning is what matches here.
I can hear you wondering what it remain only 18 months should ever mean.
Bleiben is a very special verb. A good dictionary will tell you that. It's one of the three explicit copula (coupler verbs) German has: sein, werden and bleiben. (There are some more which are also used as couplers, but less often.) That relation to the auxiliaries sein and werden tells you some magic will happen here. Remember the (übrig) from the beginning. It also means remaining, and to make it even more complicated, there's also a verb übrigbleiben which also means to remain. Let's not assume that's some uber-remain meant here. German sometimes just doubles an idea without a special reason. (Same as for nur noch.)
- A is B (to be / sein)
- A becomes B (to become / werden)
- A remains (being) B (to remain / bleiben)
A is the subject and B is the predicative – a property assigned to the subject. Though German allows —as usual— switching the order of A and B. Because of the V2 rule this sometimes involves the use of a dummy subject es:
Nur noch 18 Monate bleiben (übrig), …
Übrig bleiben nur noch 18 Monate, …
Es bleiben nur noch 18 Monate (übrig), …
A more accurate translation uses to be instead:
There are only 18 months remaining.
(On first look it's not even clear if are remaining is a continous form or the copula to be plus a predicative. Don't worry, the ambiguity is the same in German. There, it's often not clear if it's a passive form or a predicative.)
And this also clarifies what es is. If you put in a singular predicative instead, you see it:
It is only one cookie left.
(Though, there would be more common in English I think.)
Are we through this yet? Unfortunately, no. Remember there was blieben in your example? A past tense form to describe a current or future event? What kind of insanity is that again?
And not the easy way either. What you have there is indirect speech using Konjunktiv II instead of Konjunktiv I because the plural Konjunktiv I forms of bleiben are are the same as the Indikativ forms.
English backshifts instead. Putting it all together, your example translates into
(They say,) there were only 18 months left to save the climate.