I have a computer PSU which has +12 and -12 volt rails. Although on the side of the supply it says that the -12V line can only deliver 0.5 A, I have tried connecting the +12 and -12 lines across a 5 ohm resistance in order to get 24 volts across it, and when I measured the current it said 4.6 A. Why does this work? How safe would it be to use this method to get 1.5 A at 24 volts for longer time intervals?
It depends greatly on the exact power supply model, but in general I would not use it unless you example the schematics of your PSU.
In this schematics, +12V and -12V actually come from the same winding on the transformer. The only difference is -12V has PR1507 diode rated 1.5A, while +12V has U20C20 high speed, dual diode rated 20 amperes. So if your PSU looks like this, you can get +24V as long as you make sure the diodes do not overheat (it is quite possible that -12V diode has no proper heatsink, and thus it cannot handle full 1.5A for extended periods of time)
In this schematics, -12V comes from a separate transformer using 7912 regulator. If you try to draw too much current, either L4 will not be able to provide it, so the voltage will sag, or 7912 will overheat. D5 will then start conduting and your -12V line will measure around +0.7 volts. If your PSU looks like this, you should not try to get +24V from it.