This is a vblog by www.surfncircuits.com. The video describes how to use the Raspberry Pi Imager to perform a headless setup and connection for the Raspberry Pi Zero W model. It will work similarly for other raspberry pi systems.
1. It uses Raspberry Pi OS Debian 11 bullseye
2. Raspberry Pi Imager ver 1.7.3. https://www.raspberrypi.org/
Check out the www.surfncircuits.com blog: https://surfncircuits.com/2022/12/11/simplifying-wifi-connections-for-raspberry-pi-zero-w-projects/