To retrieve data from Mac and transfer it to Mac or PC
Start up the old Mac while pressing and holding the T key until the FireWire or Thunderbolt icon appears. Connect the old Mac to the new one with a FireWire, USB-C, or Thunderbolt cable. An icon of the old Macs drive should appear on the desktop of the new Mac, just like an external hard drive. Copy the data as you would from any external drive. This method is called Target Disk Mode and works with most Macs made from 2000 until 2020 Intel-based models. Note that traditional USB is not supported - only USB-C or Thunderbolt. You can even use this method to transfer data from a non-booting Mac to a PC.
If you're transferring data to a PC, you will require additional software to read the Mac file system (HFS+ or APFS), such as MacDrive or Paragon HFS+.
To Retrieve Data from Macs with M1 Chips (2020 and Later)
Shut down the M1 Mac, then hold the power button until 'Loading startup options' appears. Select Options, continue, and choose a startup disk if prompted. Enter the admin password if required. Once in Recovery Mode, go to Utilities and choose Share Disk. On the receiving Mac, open Finder, navigate to Network, and connect to the M1 Mac as a Guest. After transferring the data, Stop Sharing on the M1 Mac.
This method is useful even if the old Mac isn't booting up, allowing you to recover data.