The preparations for the nuclear war that go on throughout the book are a form of foreshadowing. At the end of the book, the city where Montag had lived gets destroyed in a nuclear explosion. We assume that many other cities are getting blown up as well.
The nuclear war has to happen for the plot to work out the way Bradbury wants it to. He wanted this book to have an ending that left at least some amount of hope alive. The nuclear war gives hope to Montag and the rest of Granger's group because they hope that maybe they will be able to rebuild society and have it be a better society than the one the fled from.