How many different chains exist within a specific pdb file?
In the PDB format the lines with atoms can start either with ATOM or HETATM.

Chain ID is in column 22, i.e. it is 22nd character of a line that starts with ATOM or HETATM. (Programs that support 2-character chain IDs use columns 21-22 − it's a popular extension of the PDB format).

Yes, the number of different chain IDs is the same as the number of "chains" in the PDB file.
But note that the "chain" from the PDB format is not necessarily a real chain (polymer). It may be a bunch of water molecules or something else.