Nerd Alert! If you are really smart and want to understand how JPG compression works check out this video from Computerphile. It's way over my head and I just shoot raw but I thought I'd post this just in case you care about this!
All I know is, thank god for people like this. Without brilliant folks like this there would be no digital photography!