Check the warranty first. Many manufacturers cover the compressor for ten years when the system was registered. That removes the cost of the part and often makes replacement of the compressor the clear choice.
Then use the age. Multiply the system’s age by the repair quote. Past about $5,000, a new system deserves a real comparison. A $3,000 compressor in a five-year-old system is a repair. In a fourteen-year-old system it usually is not.
Then the refrigerant. If the system runs on R-22, replacing the compressor means refilling it with a refrigerant that is no longer produced. That money is almost always better spent on new equipment.
And find out why it failed. Compressors rarely die of old age alone: low refrigerant, a dirty coil or a weak capacitor usually comes first. A new compressor in a system with the same problem will fail the same way.