Why do 3D printers have only one limit switch? I have seen that many 3D printers have only one limit switch for each axis, how does it know where to stop on the other end?

My first guess is that the machine knows how big the plate is, and calculates it accordingly.

If this is true, then if I were to use a RAMPS, I would have to modify the software to figure out the build plate, it won't have the hardware to autocalculate.
In principle you only need the minimum axis position (or the maximum), the offset to the bed and the size of the bed in the direction of the axes. Fortunately, you can specify this in the firmware:

E.g. in Marlin Firmware offsets are defined as travel limits:


// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -33
#define Y_MIN_POS -10
#define Z_MIN_POS 0
#define Z_MAX_POS 240


Bed size:


// The size of the print bed
#define X_BED_SIZE 200
#define Y_BED_SIZE 200


Do note that some printers do have maximum endstops on top of minimum endstops. This is handy in case of layer shifting (e.g. caused by the nozzle catching the print as such that the belt skips notches and as such redefining the reference frame) to prevent the carriage from destroying the printer at the maximum of the axis.