So which is it? If it's figurative, do we know what the fire
represents? If it's literal, do we know what will cause the fire?
The answer is both, but the burning refers neither to fire caused by man nor any natural processes.
Coming of Christ
When Jesus comes again, He will come in power and great glory.
See Matt 24:30, Mark 13:26, Luke 21:27, D&C 45:44, JSM 1:36.
The scriptures speak of different fates for the wicked and the righteous:
1 For behold, the day cometh that shall burn as an oven; and all the proud, yea, and all that do wickedly, shall be stubble; and the day that cometh shall burn them up, saith the Lord of Hosts, that it shall leave them neither root nor branch.
2 But unto you that fear my name, shall the Son of Righteousness arise with healing in his wings; and ye shall go forth and grow up as calves in the stall. 3 Nephi 25:1-2
To behold the presence of God (or the power of God), a mortal must be transfigured, which transfiguration depends on the will of God, and in this case, the righteousness of that person at the Second Coming. See Transfiguration - lds.org
Evidence of this exists in many places in the scriptures:
Nephi, when filled with the power of God stated, "I am filled with the power of God, even unto the consuming of my flesh; and whoso shall lay his hands upon me shall wither even as a dried reed." 1 Nephi 17:48.
A similar thing happened with Abinadi: Mosiah 13:3
Moses, after seeing God, taught "mine own eyes have beheld God; but not my natural, but my spiritual eyes, for my natural eyes could not have beheld; for I should have withered and died in his presence." Moses 1:11
the earth will be cleansed by fire
This cleansing is what is referred to as the transfiguration of the earth into it's renewed, paradisaical state: Millennium and Glorification of the Earth. Note this is not the final glorification of the earth, when it will be sanctified and celestialized, when the earth "will be made like unto crystal and will be a Urim and Thummim" D&C 130:9, which will occur some time after the Millennium, see D&C 88:19
Elder Bruce R. McConkie clarified the burning heat will have a physical effect on the earth itself:
“When the Lord comes in his glory, in flaming fire, that fire will both cleanse the vineyard and burn the earth. In that day, so intense shall be the heat and so universal the burning, the very elements of which this earth is composed shall melt. The mountains, high and glorious and made of solid rock, shall melt like wax. They shall become molten and flow down into the valleys below. The very earth itself, as now constituted, shall be dissolved. All things shall burn with fervent heat. And out of it all shall come new heavens and a new earth whereon dwelleth righteousness”. McConkie, Millennial Messiah, 526–27