macos – How does display scaling work on Mac

So, I have a MacBook Pro 15” and I recently bought an LG 27” 4K monitor.

When I connected the monitor, system report said that the original resolution is 4K but the picture looks like 1920×1080 (using 4 pixels for 1 displayed pixel) on the screen. The text was too big for me.

I was then able to access scaling options and opted for the option that looks like 1440p with the original resolution of 5k. This seems to give the best image and size for this external monitor.

Now, I want to understand why the image is clear at what looks like 2560 x 1440 on my 4K monitor since the pixel distribution is not a modulus of 0. In my understanding, there is no way to distribute a 5k picture on a 4K monitor and yet get a clear picture. Since 5k is only 1.33 times bigger than 4k horizontally and vertically, how does it render? Is the picture quality worse than I think?