Each file and all of the blocks within it are given a unique fingerprint called a cryptographic hash.
IPFS removes duplications across the network and tracks version history for every file.
Each network node stores only content it is interested in, and some indexing information that helps figure out who is storing what.
When looking up files, you're asking the network to find nodes storing the content behind a unique hash.
Every file can be found by human-readable names using a decentralized naming system called IPNS.