That is, if I have a PS/2 device and I do not know which cable should go to which pin on the PS/2 connector (that will plug into the PS/2 port of the computer), how would I go about finding this out?
Open it up and take a look at which line goes where on the circuit board. Given some IC with known pinout, it shouldn't be too hard to identify Vdd and Gnd with continuity test. Once you have those, the rest would be Clock and Data for a keyboard, which seemingly can be reversed without anything blowing up, so you can swap those around if it doesn't work. Not sure 'bout mice.