Mobile ad networks are typically marketplaces - they bridge supply(from publisher apps) and demand(from advertiser apps).
Ad networks have relationships with publishers or exchanges - they buy traffic from these(typically on a CPM basis). They also do deals with advertisers to sell this traffic, usually on a CPI basis.
Every time an advertiser's campaign requests to serve an impression, an ad network's tech/algorithm looks at the various publishers available to serve this impression on. The tech/algorithm looks at:
a. past performance of the advertiser's campaign.
b. current targeting & bidding of the advertiser's campaign.
c. past performance of the user who has viewed the ad impression.
d. other advertisers' ad impressions that are likely candidates to be served to the publisher app.
e. any blacklists applied by either the advertiser or the publisher.
Based on all these, the tech/algorithm then assesses what publisher apps are most likely to be effective in driving installs(and ideally post install events) - and serves the advertiser's ad impression to the publisher app that the algorithm deems most likely to drive an install.