Tile servers are an interesting thing, there's 70 TB of data composed of 256x256 prerendered images on one end, and a user wanting a picture that goes below some weird angles they have on the other.
They call the map setup a "slippy map", and it's composed of up to around 20 zoom levels, each one being a subdivision of the previous one. So the first tile covers the entire planet, the next one is split into 4, and then into 16, etc. Level 20 zoom which is used to be the max offered by OSM (now only 19 it seems) is roughly a trillion tiles, each measuring up to about a 40 meter square. https://wiki.openstreetmap.org/wiki/Zoom_levels
Anyhow, these tile servers let you request tiles in a somewhat standard format of http://url.com/zoom/x/y.png. X and Y not being the latitude and longitude of course, but they are tile indexes which have an entire wiki page on their calculation in most languages you'd want: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
But wait, we live on a spheroid don't we? Projecting a sphere onto a flat plane has always been a futile endeavour (https://xkcd.com/977/) but what's used by functional maps at large seems to be Mercator. It's mostly fine, but it does have this tiny issue that the tiles aren't all the same size in all places. So for example at max zoom Saudi Arabia gets 0.149 m/pixel while Iceland only gets 0.06 m/pixel, which means you need more tiles the further away from the equator you go. How many do you need at the poles you ask? Well...
I'm not entirely sure how this tile size fits together with the fixed subdivision setup, but boy am I glad I didn't need to figure that out. Luckily if you're rendering just one part of the map at high zoom you can just scale it properly, tile it sequentially, and you can forget the rest of these shenanigans and treat it like it's linear space. If you can live with that it's not too hard.