This is touched on a bit in this travel.se question. Strictly speaking they don't really keep "spares" per se. It's just too expensive.
There are a lot of factors to this and flight planning has gotten much better over the past few decades so planes are rarely flown empty, moved for no reason, or just sitting around any more like they did in the past. The prevailing mentality is that an aircraft is only making money when it's flying, so keep it in the air as much as possible.
However the reality of airline operations requires aircraft to come in and out of service every so often for maintenance and routine checks. This creates a bit of wiggle room in the fleet, so while there are no spare aircraft per se, a fleet of sufficient size may have excess resources. The chances of getting a replacement aircraft are greatly increased if you are at an airport the airline considers a hub or an airport that has large maintenance facilities. Ultimately the demand is not always there to keep all planes in the air all the time so spare capacity is sometime driven by the nature of the business.
In your particular case it's also possible another aircraft was swapped in with the assumption the HF would be fixed fairly fast and thus capable of being dispatched for a flight in fairly short order filling the void it created.
A plane could not be flown in at a moment's notice, obviously, because
it could take hours for it to arrive.
That depends on where the other plane is sitting. Sometimes an aircraft can be flown in if it's sitting at a nearby airfield.
These days it's often cheaper for an airline to cancel the flight, put everyone up in a hotel and book them on the next available flights to the destination. This will obviously be weighed by the airline prior to doing so, but it's a risk they know they have and one they are typically fairly prepared for.
The only operation that I know of, that keeps a full spare on hand 100% of the time, every time, is Air Force One.