Polyfuses on the RAMPS
Fire appears to be the immediate issue, in the poly fuses.
From Reddit: reversed polarity, RAMPS on fire
Sooo I made the dumb mistake of reversing the polarity from my psu into the RAMPS 1.4. As warned the ramps did not like this and smoke began to rise from the board. I am pretty sure I saw smoke only coming from the two ptc fuses (big flat yellow ones).
Replacing poly fuses
Note: Older RAMPS 1.4 have easily replaceable large poly fuses, whereas the RAMPS 1.5/1.6 use SMD poly fuses, see 0scar's answer to RAMPS 1.4, 1.5 or 1.6?
According to this user, the MOSFETs and the Arduino Mega's regulator can be fried as well:
it most likely fried the mosfets next to the fuses and probably the voltage regulator on your arduino.
However, the fried regulator would only affect the Arduino's operation if powered through the power socket, or VIN (which the RAMPS board uses to power the Arduino Mega). However, via the USB it should still work. See this post, on the same thread:
The voltage regulator is only needed if you supply power to the arduino via the Vin pin or with a separate power adapter. The RAMPS board does supply the Vin pin with 12V.
So, you would probably have to rely on powering the Arduino via the USB and not the RAMPS
Regarding the Arduino, on Arduino.SE there are a number of users who have fried their Arduino in this manner, and many of them suffer slightly different failures, although most are centered around the regulator. One case I remember was that of a capacitor burnout, see Is my Arduino dead? - although the use case was different. There are many other cases on the Arduino.SE.
According to this post on RepRap - Reverse Polarity, there should be a reverse polarity protection diode (although it appears not to have work in the above example):
If it was a ramps, those have a reverse protection diode across the input that normally needs replaced after such an incident
The stepper motors themselves should survive, as should the stepper drivers.
However, each case can be different and it would depend upon the quality of the board (is it a cheap clone or branded?), and the quality/tolerance of the components used - these factors would determine where in the chain of modules the failure occurs. Obviously, the earlier the failure's location in the chain the better.
MKS Base v1.2
As an aside, this user fried their regulator (the fuses were fine) on a MKS Base v1.2 (not RAMPS), by reversing the polarity, which caused the stepper drivers to fail. However, replacing the regulator fixed it, see this post:
Replacing the regulator chip did fix the board.
Rather helpfully the self same user has posted an Instructables of the repair: MKS Base reverse polarity repair.
There is no protection diode on the RAMPXB. From RAMPSXB:
Do NOT reverse polarity on the input pins, as there is NO PROTECTION DIODE. Reversing polarity will not only fry your steppers and FETs, but may even damage your Arduino and possibly even your computer. Triple check to make sure the polarity on your power input is 100% correct!
This user on post #5 of Arduino Forum: Checking the RAMPS 1.4 did manage to fry their stepper drivers, but not due to reverse polarity, by from a loose wire:
I didnt connect the power backwards, but either I had a defective Mega2560 clone, or some stray bit of wire somehow shorted something out, and the Mega2560 literally went up in smoke (almost caught on fire !)
Every stepper driver was destroyed, but the power FET's and other components survived