Methods for adding digital car keys to your iPhone vary from one car to another and may require you to be near your vehicle to work. Unfortunately, depending on the car, you might also need to physically touch your phone to your key reader during set up. Apple isn't clear if there are specific cars or Car Key features that determine whether you'll be able to set things up without being next to your vehicle.
The initiation of the setup process also differs based on make and model. You might receive an email or text message from your car maker prompting you to add a key, or you might be able to add a key to your Wallet through your car maker's app. The setup process may also require you to create an account with your car maker and associate it with your car. When you're eventually sent to the Wallet app, tapping Continue will pair your iPhone with your car. Follow any onscreen instructions to sync the NFC chip in your iPhone with your car, which in some cases may involve tapping it to your car's key reader.
Once paired, you should be able to lock and unlock your car directly from the Wallet app. Apple says on its support page that Express Mode will also automatically be enabled so your car will unlock without you having to remove your iPhone from your pocket.
You can also share a key by selecting it in the Wallet app and tapping on the Share button. You'll be prompted to name the key, choose whether to add an activation code for extra security and then select a contact to send it to. The Wallet app will ask you to authenticate your identity before sending the key. If you did set an activation code, you'll have to send that one-time code to your contact so they can unlock and use the key.
If for whatever reason you lose your iPhone, marking it as lost in the Devices section of the Find My app automatically disables any digital keys you have stored. Notably, any keys you've shared will still be usable, but it's otherwise the simplest way to lock down your phone and Wallet app. If your phone happens to run out of juice when you need to unlock your car, Apple says certain keys, cards and passes with Express Mode enabled will be still usable for five hours after your battery dies. Regardless of the scenario, though, you should keep a copy of your actual keys as a backup.