Basically it works by nothing being stored automatically by others.
When you first connect to the network with a fresh IPFS node, you’ll have only a small set of “starter” files, like basic instructions and similar.
Nothing gets added to your node automatically, and the same goes for when you add content. It doesn’t automatically distribute content to other nodes. Other nodes needs to run
ipfs pin add $HASH to start resharing content. Also, when doing
ipfs get $HASH (or
cat) it also helps resharing the content but only until you run garbage collection.