"ID number" redirects here, for the player's ID number, or 'secret ID' please see Bulbapedia's respective article.
In the Pokémon games, an identifier (also index number or ID number) is a number used within the game's code to identify pieces of data. Pokémon, items, locations, moves, and abilities all have unique identifiers; in each game, no two Pokémon have the same identifier. Pieces of data in different categories, however, may share identifiers -- a Pokemon and an item may use the same identifier, for instance. Identifiers may be likened to character codes in computer text.
If the size of data is one byte, this usually means that the data can be represented by 256 index numbers (16^2 or 2^8). If the size is two bytes this would mean the data could be represented by 65536 index numbers (16^4 or 2^16) and so on.
An identifier is the value in a memory address, or the two digit number in the second and third digits of a GameShark or Xploder code/first two digits in a Game Boy Game Genie code (for example, in 01xx59D0, 010259D0 means the index number is 02).
In the first generation core games (Red/Green/Blue/Yellow versions), the Pokémon's identifiers did not match the Pokédex numbers assigned to them (e.g. Pokédex number 1 is assigned to Bulbasaur, while identifier 1 is assigned to Rhydon).
This is believed to be due to Pokémon being assigned to these numbers during game development (confirmed by a few Pokémon having them in the official Satoshi Tajiri: The Man Who Created Pokémon manga namely Diglett and Venonat). A few placeholder or unused entries remained in the final game, known as the MissingNo., which there are 39 of.
The identifier, not the Pokédex number, must be used for cheat codes and in-game glitches like the Old Man Trick or Ditto Trick.
Later generations have Pokémon index numbers that match their Pokédex order, except for Generation III, which includes "?" glitch Pokémon in between the index numbers of Celebi and Treecko, and certain Pokémon in an earlier or later order, such as the Ralts line existing later on in the internal ordering, grouped before the Bagon family.
Item identifiers are relatively constant throughout generations (i.e. item ID 1 is always the Master Ball).
An identifier is also referred to as a "hex", due to the fact that identifiers are often represented in hexadecimal notation.