Answer:
Think of DNA-there are only 4 bases, but different combinations give infinite possibilities.
And the same for amino acids and proteins.
Immunoglobulins work on a similar principle. Different VDJ segments are combined for the heavy chain of an antibody. Different VJ segments are combined for the light chain.
Other ways:
Random nucleotides may be added or removed between the gene segments.
There are also different combinations of light and heavy chains.
Antibodies can be any of the 5 isotypes: IgA, IgM, IgG, IgE, IgD.
I'm not going to go into detail as this answer would take too long to write. Do some literature searching on B cells, V(D)J recombination, RAG genes, class switching.