How does butter remain edible for so long without refrigeration?
Actually, the question should be "why do other dairy products spoil so fast?"

If I remember correctly, the spoilage of milk is caused primarily by lactose, which breaks down into lactic acid over time due to the presence of Lactobacillus bacteria, which thrive in that environment.

Butter is mostly fat, and fat does not go bad (it does eventually, but not in the same way or at the same rate - see below) - lactose and sugars together, on the other hand, go bad quite fast.  That is also why cream lasts longer than whole milk, and whole milk lasts longer than skim milk.  It is also the reason why lactose-free milk seems to last forever - there's nothing to break down, nothing for the bacteria to feed on.

When butter does go bad, it's generally not even for the same reason - it's simply due to oxidation which causes rancidity, similar to a typical vegetable oil.

In short, butter lasts so long with or without refrigeration because proportionally speaking, it doesn't have as much of the lactose that causes other dairy products to go bad.