Content Targeting Keywords

For content targeting, does anyone know how Adwords or Yahoo chooses to show which ad? Do they do this by seeing if any of the keywords from the campaign are in the web page? And if so is there a way to track which keyword they used when there are conversions from content targeting?

Original post by bridgetimi