Protein (keratin) is an important structural component of human hair. When hair is curled through a perm treatment or straightened, these proteins "break" and then reform. This is what gives hair the desired style.
Keratin is a fibrous protein structure in the hair and nails and also often serves important structural functions in cells. Keratin maintains the shape and style of hair (curly or straight) by "hugging" really tight and forming bonds. Think of curly hair as spiral shaped stairs while straight hair is a normal vertical ladder. When you heat up the "spiral ladder" the bonds break and then reform when cooled , essentially rebuilding the spiral stairs.