AdSense ads are displayed in the same order that they would be if one was performing a query on Google. The order is dependant upon how much an AdWords advertiser bids and their CTR (ad performance). The quality (how high up the chain) of ads displayed on an AdSense publisher site is dependant upon the publisher's CTR.
For example, suppose the following 10 AdWords advertisers are bidding on the keyword "computer".
AdWords advertiser #1 = Best CTR and high bid = top placement
AdWords advertiser #2 = Good CTR and medium bid = middle placement
AdWords advertiser #10 = Poor CTR and low bid = low placement
Now suppose there are three AdSense publisher websites which each have content that rates equally well for the keyword "computer". Additionally, each publisher is using an ad unit that can display three ads.
AdSense publisher #1 = High CTR
AdSense publisher #2 = Medium CTR
AdSense publisher #3 = Low CTR
Publisher #1 might display the top three performing AdWords advertisers, Publisher #2 the medium three, and Publisher #3 the bottom three.
As you can see, as an AdSense publisher, the higher your CTR, the higher the quality of advertisers you get for a particular keyword. Yes, every keyword performs differently, and that is why some sites make two cents per click on average and other sites make twenty cents per click on average. But across a single keyword, the better your performance, the better quality advertisers you get.
Secondly, you'll notice poor AdWords advertiser #10 was too far down the chain to be on an AdSense publisher's site. AdWords advertisers also need to keep their CTR up because that means they can bid less and still get the same top position, and it makes sure that they are high enough up the ladder to make it into the top X for a particular keyword.