These are simply advertisements related, in theory and often practice, to the content of a page.
While contextual ads. can be engineered by you, the most common type is Google adsense. Google adsense is probably the easiest to install, and demands very little of your time.
A publishing account is opened, and after approval, you will have access to the code that makes it all happen.
This code is written in JavaScript, a scripting language that is interpreted by your browser, which is its business, incidentally. Your publishing i.d. is automatically built into the code that they supply. This is simply for payment purposes.
After that, you just need to copy it and paste it into the page, at the editing stage.
The position that your contextual ads. appear in, when viewed through a browser is up to you, though some S.E.O.