Contextual advertising is a form of targeted advertising for advertisements appearing on websites or other media, such as content displayed in mobile browsers. The advertisements themselves are selected and served by automated systems based on the content displayed to the user.
How contextual advertising works
A contextual advertising system scans the text of a website for keywords and returns advertisements to the webpage based on those keywords.  The advertisements may be displayed on the webpage or as pop-up ads. For example, if the user is viewing a website pertaining to sports and that website uses contextual advertising, the user may see advertisements for sports-related companies, such as memorabilia dealers or ticket sellers. Contextual advertising is also used by search engines to display advertisements on their search results pages based on the keywords in the user's query.
Contextual advertising is a form of targeted advertising in which the content of an ad is in direct correlation to the content of the web page the user is viewing. For example, if you are visiting a website concerning travelling in Europe and see that an ad pops up offering a special price on a flight to Italy, that’s contextual advertising. Contextual advertising is also called “In-Text” advertising or “In-Context” technology.
Apart from that when a visitor doesn't click on the ad in a go through time (a minimum time a user must click on the ad) the ad is automatically changed to next relevant ad showing the option below of going back to the previous ad.