We add up a typical day: the time your ESP32 spends awake doing its job, the time it keeps Wi-Fi up to connect and send, the rest of the day in deep sleep, the battery's own self-discharge, and a few OTA updates a year. Then we divide the battery's usable capacity by that daily total.
Each chip and battery choice fills in typical values from Espressif's datasheets and the battery's chemistry; open Advanced to change them. On most battery devices, Wi-Fi is the biggest cost, so how often a device connects matters more than anything else.
Deep sleep current depends on the whole board, not just the chip. An ESP32 chip sleeps on microamps, but many development boards draw far more asleep, through their voltage regulator, power LED and USB-UART bridge. Measuring your own board in deep sleep gives the one number that changes the answer most.