Apparently there were some unplugged wires of some sort on my previous Mac.
The laptop went to the store and came back the same day.
I don't know whether that has fixed all its problems, but at least it proves that there was definitely something wrong with it.