Short answer, using Ajax you can reload any part of the page by obtaining HTML fragments from the server or obtaining information in some format like JSON, XML and generate the HTML code in the client by means of javascript.
Long answer, what you see on YouTube is not a simple effect, YouTube, Facebook, Soundcloud are what is known as Single Page Aplications, these pages use frameworks on the client side that allows a web application to work in a single page without reloading the entire page, frameworks that allow you to do this there are many for example Angular, Backbone, Meteor etc. or what is fashionable React, React-router and Redux / Flux, all these frameworks use the PushState implementation introduced in HTML 5 that exposes an API implemented in browsers that allows you to control the history, in this way when you browse the portal the URL of the page changes but the browser does not load the page again instead it remains on the page where it was and it is framework work that you use to provide a mechanism by which you control the browser routes and change the Current view of your application through Javascript and / or Ajax.