How it hits a number
The tool re-encodes the image at a series of quality settings and keeps the best one that fits under your limit. If even the lowest quality is too big, it steps the pixel dimensions down until it fits, which is what keeps a 20 KB target realistic for a very large photo.
What 20, 50 and 100 KB are for
Around 20 KB is the ceiling for some job portals and visa forms; 50–100 KB covers most email attachments and ID uploads; 200–500 KB is a sensible web hero image. Anything above 1 MB on a page is usually a photo that should have been resized.
Why the result may be smaller than asked
The search maximises quality under the cap rather than filling it. If you need the file to be as large as possible under a limit, set the cap slightly below it and compare.