YouTube has an amazing feature that lets you watch your favorite YouTube videos without an internet connection on your mobile using 'YouTube offline' feature. You have asked how does it work?
Here is answer according to my understanding. First of, The offline feature only works on the YouTube app. Now when you add a video to offline the video is downloaded onto your device, then later you can playback that video as many times as you want in the YouTube app without having active internet connection for up to 48 hours, after that the video becomes inaccessible and becomes available again after you connect the device to the internet.
Please note that not all videos are available to add to offline, as the uploader can decide whether his/her video should be made available offline or not.
So where is the video file saved?
Well, I tried every possible way to find the file but the whereever it is stored it can only be accessed by the YouTube app and you can not playback the video on another video player on your device.
Now for YouTube publishers, it might work like this, let's say someone watched your video playing ads offline but YouTube app will refresh view counts once the device is reconnected to the internet so this way no views and ad revenue is wasted and is win win situation for both content creator and users.
So that’s how YouTube's offline feature works hope you've learned something new and found my answer helpful.