Most images are registered by finding the location of known stars from a high resolution catalog such as GAIA. So you fit centroids of all stars in an image, then do a search of Gaia sources in that location and do some sort of linear or higher order polynomial mapping of pixel space to the celestial sphere reference coordinates ICRF.
Astrometry.net is a service that does an approximate version of this on the web.
I am glossing over many details here, but this is roughly what happens.