Ralph wishes to be rescued, and thinks the fire is the best hope for rescue. He designates Jack (and his hunters) to look after the fire. They are less than enthusiastic about real work, and when the hunt for a pig is initiated by Jack, he takes Sam 'n Eric away from their duties in order to accompany him. The hunt is successful, but while the boys are hunting, the fire dies out at the same time that a ship passes which might have noted the smoke from the fire, and come to rescue all of the boys.
At the end of the novel, when Jack is leading the hunt to kill Ralph, a fire is lit to chase him out of his hiding spot. The fire spreads and it is the smoke from THIS fire that is seen by military people on a ship.
The irony is that Ralph was right about a fire being the best source of hope for rescue, but it is the fire of hatred and savagery that causes the rescue, not the fire kept going through the efforts of a civilized and organized society of boys working together for rescue. Ralph thought that being civilized would be what saved them - but ironically, instead, it was savagery.