I think initially they are based on either the rest of the site by broadly matching that content, and / or by url and filename. Once refreshed or clicked a few times (NOT BY YOURSELF!) then they get a more thorough looking at! And after some time depending on performance etc the best ads eventually "settle" on that page.
It seems to me that it is like Nitrous said. I've put up a few new pages, and initially, the ads are either off-target, or more often, on-target to other pages in my site, but after a day or two, the ads seem more targeted to the specific page.
It's fun to watch this stuff from day to day and try to figure this stuff out.