Well, for one thing you cannot know how many visits your site will get, so you cannot ensure that each ad will be shown exactly X times. For instance, if ad #1 is to be displayed 100K times, and ad #2 is to be displayed 200K times, but you get only 150K visits, then you cannoy possibly satisfy anything. And on the other hand, if you get 600K visits, then every other visit should have no ad. But you have no way to predict this in advance.
Hence, I'd advise the same thing as tskuzzy - pick ads on random, but adjust their probabilities so that they approach the right amount of views. And, of course, track how many times each ad has been shown, and remove it from the rotation once the limit has been reached.
Let's look at an example. Suppose you have two ads. Ad #1 still needs to be shown for 7 more days, and needs to get 70K more views. Ad #2 needs to be shown for 10 more days, and needs 20K more views. So, ad #1 should be shown on average 10K times each day, and ad #2 - 2K times each day. So the probability of ad #1 coming up should be 10/(10+2)=5/6, and the probability of ad #2 should be 2/(10+2)=1/6. Hence for every 12K views you will get on average 10K views of ad #1, and 2K views of ad #2. Which is what you need.
Recalculate these probabilities at the start of each day and only add new ads at the same time. If you add new ads in the middle of the day, it will complicate things. However it will work just as well if you calculate time in seconds, not in days, so you might do that too for a greater accuracy. Just keep an eye on performance if you recalculate everything so often.