The other variants ("Id" and "id") wouldn't usually be used in normal writing contexts, but are quite common in some computing contexts. For example, a common convention for naming functions/methods is to capitalise the first letter of "words" and treat abbreviations as normal "words".
@FumbleFingers - Let me agree that "ID" is short form of "Identity Document". But, we find a commonplace thing, such as, "What is your email ID" or "What is your email id". Obviously, the speaker is asking for "email Identity" or "email Identifier" and not for "email Identity Document" or email Identity Card".
It's actually about whether Id is short for "Identity" or "Identity Document", and therefore it's really about English. But it probably doesn't matter either way in code, since most camel-cased languages idiomatically only capitalise the first letter of acronyms.
ID, sometimes spelled I.D., as referring to something related to identification or identity. Most dictionaries say it is an abbreviation of one of these words. Etymonline says it's specifically for identification, and gives 1955 as the earliest usage. Can anyone confirm or correct this information, perhaps with better sources?