you can use php to do this - its pretty easy to do, there are two stages to this, firstly make a .php file (I'll call it advert.php) inside this file you will need to place the code to display your advert. Then inside the pages at the point where you want the advert to appear, simply put the code
Code:
include "advert.php"
inside your php tags
You can find more info here
PHP: include - Manual