I used to work in Traffic at 2 of the major UK Radio Groups, and the process is very similar to that in TV. Indeed many Radio Traffic people either come from or move into their TV equivalent roles.
Take an example such as this:

All the Group's stations come together into 'network' overnight.

To begin with, each individual station will schedule it's own adverts into pre-determined ad breaks (with a maximum number of ad 'spots' available in each break).

Then when the 'ad logs' are completed, a systemwide process of 'balancing the logs' is set in action.

What this does is the key - it goes through the complete 24 hours of a day, making each break match according to whichever station has the longest break in each instance (hope that makes sense).

For those stations which don't have enough ads in their break to make up this duration, 'filler' ads are inserted to make up the difference.

These filler ads are essentially random free spots to any advertiser who is already on air in paid-for spots at that time of the day. The viewer will never know, and the advertiser gets a free bonus! Therefore it's always better to have a full ad-break than a half-empty one. The same number of ads will play, but there would be less free ones!

If there aren't any available, that's when the fall-back of programme promotions come in (in TV terms, if you ever notice a break full of trailers - chances are that's what's happened: not enough ads available to make up the break).
Now that ITV are always in 'network', the 'balancing' is done for the whole of the day.
Hope that makes some kind of sense...