There are a huge number of 3D shapes a protein can be in due to the folding of the polypeptide chain. The nitrogen containing rings are referred to as bases. Most fundamental role is the storage and retrieval of biological information. Genetic information directs the synthesis of proteins. DNA does not direct protein synthesis itself, RNA is used as an intermediate.
Nucleotides can also serve as short-term carriers of energy.
ATP participates in the transfer of energy.