The dpi number is simply one additional and separate small word stored somewhere in the file, which contains one number, like 72 dpi, for a poor example. It is just a number, one single number, and it has no effect on the image until we print the image on paper. However the video system does not need the dpi concept, it does not use dpi. The video screen simply shows all the pixels, one image pixel at one screen pixel memory location, without exception. The screen has no use whatsoever for any dpi number.
Scanners do use dpi to create that image.
Dpi is the method used by scanners to take color samples to convert inches of photo paper to be pixels for the digital image. Dpi means pixels per inch. Inches are on paper. Printers also use dpi. This dpi spacing establishes printed size.