So the 4th amendment of the US Constitution, which outlines the freedom from unreasonable search and seizure, protects people from being forced to verbally identify or show documents of identification without reasonable cause, among other things. What that has been interpreted to mean by the SCOTUS is that, while they can always request ID without it being a lawful order, a request you can deny without consequence, any policy or state/local ID law that requires identification upon officer request without any other reasonable cause is unlawful. In other words they cannot demand id for no actual reason nor punish you for failing to ID without said reason.
At minimum, they need "reasonable and articulable suspicion" of a real crime that has happened, is happening, or is about to happen, in order to legally require you to ID yourself in every state, district, and city in the country (with the exception of if you are driving a car and get pulled over for a lawful infraction, you must provide your license to prove you're allowed to drive the vehicle). "Reasonable and articulable suspicion" means that there are real facts that can be pointed to that a reasonable person would deem as a likely indication of crime, not hunches or racial profiling. Some states have higher levels of requirements in order to ID someone, but none can have lower requirements.
BUT, the unfortunate and infuriating truth is that they do not need to actually explain their reasonable and articulate suspicion to you at the time, which ultimately means that they dont have to have it until they justify it to the court much later. They could be just demanding it for no reason unlawfully. Or they could be demanding it because they just saw you pick pocket someone, or someone pointed you out as someone that threatened them, or you match the description of the person that just broke a bunch of windows nearby. All of those things qualify at reasonable suspicion allowing them to ID you in places where that is the minimum requirement. Even if you did nothing wrong, you could still match a description but aren't the right guy, or they thought that saw you do something unlawful but were actually mistaken. It doesn't matter. They still have reasonable suspicion unless you somehow factually dispel that suspicion. If you do not dispel that suspicion (maybe because they didn't even explain their reasons in the first place) and they demand ID, you can be lawfully required to present it even if you did absolutely nothing wrong and don't have a clue why they are asking at all.
In other words, if they demand ID and don't explain why, there's functionally way to discern at the time if the demand is lawful or unlawful even if you have committed no crimes. So you either comply or go to jail and argue your case in court later, regardless of the truth. And btw, even if they had absolutely no reasonable suspicion to lawfully demand ID at the time, they can just lie to justify it. If the lie is not demonstrably shown to be a lie by other evidence, it's assumed to be true. So... enjoy your "freedoms", I guess.
As another said, reasonable and articulable suspicion is required to id in every state and city in the country regardless of any lower laws or department policies. However(!), they do not have to share that reasonable suspicion with you at all, and can still demand ID without giving it to you. They can have reasonable suspicion against you that you are not aware of, such as matching a description for a crime you're not involved in. And They could very well have no reasonable suspicion and can lie in the report later if they need to justify it. So long as there isn't evidence contradicting them, the cop's word is assumed as fact. So a demand for ID that is lawful is indistinguishable from an unlawful one if they don't give you the details of their suspicion because you have no way to know if such reason exists or if it's reasonable or not.