I don't have an answer for you in regard to Android.

For Windows, Microsoft offers an ad SDK that includes ad serving that can be customized to ad size, types of ads, and more. I'm sure there are multiple similar solutions for Android:

http://advertising.microsoft.com/mobile-apps