What is the aim of insertion codes in the pdb file format? In PDB file we always see insertion codes (ic) in a few proteins. Could anybody please tell me why it has been added in structure and what is the aim of that ???
When I wondered it myself years ago and I found a good explanation in a mailing list archive. I think it was this one, by Frances C. Bernstein:


  The problem with numbering started when people wanted to compare the
  'same' proteins from different species.  They found that there were
  the following possibilities that gave rise to differences:
  
  
  More or fewer residues at either end.
  Extra residues at various places within the chain.
  Fewer residues at various places within the chain.
  Different amino acids at the same place.
  
  
  Now imagine that residue PHE 195 is very important for the activity of
  the protein in species A.  But in species B it is residue PHE 197 and
  in species C it is PHE 212, because species B and C are not the same
  length as species A.
  
  Because people felt it was important to preserve the amino acid numbering for 'important' residues and to be able to readily discuss
  and compare the structures from different species, various people
  decided to try to number the proteins from species B, C, etc. to match
  the numbering used for species A.  In doing this, one must have gaps
  (missing numbers) where a sequence is shorter.  But what should one do
  when a sequence is longer?  This is the case where it is necessary to
  insert extra numbers and this is done by using insertion codes.
  
  Thus the insertion code is an integral part of the residue number and it is improper to ignore that field when using a PDB entry.  You
  must also allow for 'missing' numbers when using a PDB entry.


In the PDB format the insertion code is in column 27, following the sequence number (columns 23-26):

                      nnnnI
ATOM  11918  CZ  PHE D 100      -6.852  76.356 -23.289  1.00107.94           C
ATOM  11919  N   ARG D 100A     -9.676  74.726 -19.958  1.00105.71           N
...
ATOM  11970  CE  MET D 100H     -8.264  83.348 -19.494  1.00107.93           C
ATOM  11971  N   ASP D 101     -11.329  81.237 -14.804  1.00107.41           N


Together, columns 23-27 make a sequence ID, which is a mostly-numeric ID of the
residue position.

Note: It's not a full ID of the residue. When you have a point
mutation (a.k.a. microheterogeneity) you have 2+ residues with partial occupancy at the same position. To fully identify a residue both the sequence ID and residue name are needed.

As of 2020, the PDB (organization) uses PDBx/mmCIF as the primary format. The PDB format is only a legacy one. The presentation of the insertion codes (and many other things) in the mmCIF format are rather confusing, so it's worth explaining.

The mmCIF format introduced double identifiers for chains, residues and atoms: author's ID and "label" ID. Both look the same and are easy to confuse. For example: two chains named B and A by the author are renamed as, respectively, A and B by the wwPDB; both names are used in parallel: one chain is B(A), the other A(B). Poor design choice at every step. The same with the sequence ID. Originally, we had two tags:


_atom_site.auth_seq_id -- author's sequence ID, possibly with an insertion code (100A),
_atom_site.label_seq_id -- numeric-only sequence ID, numbered with respect to the sequence of this molecule (SEQRES).


Then, as I heard, numeric insertion codes were spotted in the wild. (In a database big enough any mistake that is not automatically checked for will happen). This made a problem with translation from the PDB format to mmCIF. The sequence number 100 with IC 1 would be interpreted as sequence number 1001. The numeric ICs must have been remediated in the meantime, because they absent as of 2020. But at that time (10-20 years ago?), instead of correcting the entries, the decision was made to move the insertion code to a separate column (pdbx_PDB_ins_code).
The documentation was never updated, so the auth_seq_id is still documented to store the sequence ID, not just the sequence number.

Here is an example from 3B9F:

                             !!  I                                      nn
ATOM   770  C CD2 . LEU B 2  46  ? -23.416 21.041  -27.401 1.00 19.94 ? 60   LEU H CD2 1 
ATOM   771  N N   . TYR B 2  47  A -21.191 16.717  -28.119 1.00 18.73 ? 60   TYR H N   1


The sequence IDs here are 60 and 60A. Since the meaning of the insertion code is not widely known, it landed next to label_seq_id which has nothing to do with it. So again: the insertion code is just a part of the author's sequence ID (originally, in auth_seq_id), and the letter A above (10th field) is simply an extension to the number 60 (17th field).