There's a number of things to consider when choosing batteries.
First is the capacity. In broad terms, the capacity is, mAh, means "This battery can supply X mA for one hour". So a battery of 1000mAh could supply around 1A (1000mA) for one hour before it goes flat. Simply divide the mAh by your device's mA and you get the time it will run for before it goes flat. So a 50mA device would run for about (1000 / 50) 20 hours before running flat. That is only a "ball park" figure though, since the capacity is somewhat dependent on the amount of current you draw.
Then there is the question of the internal resistance of the battery. This determines the maximum current that you can draw from the battery before the voltage drops below a usable level. Different battery chemistries have different internal resistances.
Small button cells like the CR2032 have a high internal resistance and a low capacity. A typical cheap CR2032 has around 200mAh capacity. At 50mA that would last 4 hours. But drawing 50mA from a CR2032 is not really on. Looking at the graphs in the datasheet linked to above you can infer that, with a nominal voltage of 3V, with a 1kΩ load the output drops to 2.6V. That means that 1kΩ is drawing (2.6/1000) 0.0026A (2.6mA). The internal resistance is dropping (3 - 2.6) 0.4V, therefore the internal resistance must be (0.4 / 0.0026) 154Ω.
Drawing 50mA from the battery would mean the internal resistance would drop (154 * 0.05) 7V. Since you can't get below 3V, that means the battery simply can't support that kind of current drain. Indeed, in the datasheet I link to the "Standard Current Drain" (the current it's rated for as "normal" usage) is a mere 0.1mA.
So to work out what battery you need, you want:
- The average current draw over the period of an hour
- The peak current draw the device will draw
- The length of time you need the device to run for between battery changes / recharges
For the ESP32 the current can peak at hundreds of mA depending on what you are doing (WiFi uses a lot of power in short bursts). The average will be based on the ratio of the "running" time to the "sleeping" time, and the current draw for both those states.