Most image formats have a field for DPI. It probably seemed like a good idea at the time, and indeed it is on rare occasions useful. However, it is mis-used so much more often that one wonders whether it really was a good idea.
Part of the problem lies in the software: most image-manipulation programs, though having no business filling in anything other than Unspecified, instead fill in something else, something that, although it will work sensibly when the image is later re-used by the same program, will nevertheless cause grief if the image is used by another program. One program thinking it is mainly for web-applications fills in 72-dpi; another for print-applications chokes on such a value, working sensibly only for something in the 300-dpi ballpark. And then the various programs even have their own private way of indicating "unspecified". Despite there being a documented "standard" way. In other words these "private" methods are used purely to prevent interoperability. Many software-vendors are into that sort of motherfuckery.
Adobe loves to play that game; by coming up with their own nonsensical defaults they try to convince people that life will be pure hell unless you buy nothing but Adobe products, for your image-editing, your print-layout, your logo-creation, etc. Their own programs do manage to interoperate with each other, but not with anything by anyone else, at least not with anything written by a sensible human.
The main problem is with mis-educated humans. They are amazingly abundant. After chatting with several people I've come to the conclusion that courses on "Photoshop" is where much of this mis-educating happens. An over-complicated way of thinking is central to the mis-education I'm talking about. If your print problem involves needing a 3x2-inch picture, you want 300dpi, and someone supplies a 2400x1600 photo, then you know at a glance that you have enough pixels. Thinking in "dpi" is sometimes useful, however it often leads to over-complicating things.
Where people go most badly wrong is in making deductions based on an image's DPI-attribute. Even looking at the DPI-attribute is a mistake that can only lead you astray. I've been told: we can't use that, it's only 72dpi; I've also been told: we can't print that picture, it's over 3-feet high; both of these involve a mis-educated person thinking there's sacred meaning in the "dpi" attribute an image has. With the non-standard variants of "Unspecified" you may encounter extremely silly results: one fellow complained that my photo was two-hundred feet high when opened in Photoshop (it claimed to be one-dpi; I forget which joker/pervert-written program does that). Since there's nothing meaningful about the dpi-info in an image-file, changing it to "Unspecified" is the solution to all problems!
I'm unable to think of a single situation where it's useful for a human to look at that field. Hmm, before running a misguided piece of software that uses the dpi attribute to make your life miserable, you may after all have reason to look at that attribute. In other words, users of free open-source software have no reason to look, Adobe-users may have.
One situation where I take the trouble to fill in something meaningful is for a set of web-published photos that someone may want to print. For such a set of photos I'll supply a dpi value so each will be roughly 10-inches in the bigger dimension, if I expect they'll want full-page printing. If one thinks half-page printing more appropriate then one supplies the dpi accordingly. Hmm, I didn't say that at all well: one really picks dpi so the photo fits into a 10x8-inch rectangle for full-page printing -- consider a square photo... My scalepix script uses a 10x7.5-inch rectangle; and I've decided it will supply such a dpi-attribute on all my web photos on the grounds that it probably helps more often than it hurts. (Although it contradicts my advice about "unspecified" being the "right" answer.)
Note: for web use one thinks in pixels and scales an image to a size specified in pixels (so the DPI-attribute is irrelevant); for print-media use one thinks in inches and scales an image to arrive at the desired size in inches with some constant for dots-per-inch (its previous DPI-attribute being irrelevant); and that leaves only the person who wants to print the image who needs for it to have a sensible DPI-attribute.