Protein tertiary Structure formation
Firstly, is important to remember that protein structures are dynamic due to the torsion angles between the N-terminal and C-terminal bonds. There are different conformations to expose different sequences to the outside of the protein to react/catalyze. So there is no one perfect conformation for a protein in a biological system. 

The best models we have are taken through x-ray crystallography of the crystalized protein structure. This static portrayal of the protein may be inaccurate, because the biological system will expose the protein to different hydrophobic/hydrophilic interactions than the affect of the protein to itself. 

Anfinsen's experiments were able to definitively prove the a proteins structure is coded by its amino acid sequence. To answer your question, this sequence is primarily responsible for a protein's core structure formation. 

It is still incredibly difficult to predict the structure of a protein using its amino acid sequence. The tertiary structure is a product of salt bridges, hydrogen bonds, hydrophobic forces  and polar attractive forces within the molecule  (disregarding a proteins possible quaternary structure ). Scientists  (from what I believe is Yale, but I may be incorrect), have been trying to find a pattern using computing software for years. As of right now, we cannot purely use amino acid sequence to determine a protein's dynamic structure. 

Loops and coils on the outside of proteins because they tend to compose of polar or charged amino acids. Hydrophobic amino acids tend to get pushed towards the center of the protein structure. This occurs because polar residues do not affect affect the entropy of water molecules as much as the nonpolar residues (in the system). 

Many deletions/insertions occur during specific transition states that the protein is in. Enzymes actually target specific conformations of a protein that best produces the P product. See image: