As the polypeptide backbone consists of single covalent bonds, it is pretty flexible (rotation about the single bonds is possible, full rotation for the C-C bond, less so for the N-C bond). This allows polypeptides to fold into proteins. This occurs in two steps. First, hydrogen bonds form within the polypeptide backbone between the O of a carboxyl group and the H of an amino group. This can give rise to exactly two secondary structures that form very quickly after a polypeptide has been made: the alpha-helix and the beta-pleated sheet. Note that these hydrogen bonds do not involve the side chains at all! In the alpha-helix, hydrogen bonds form in the direction of the helix, generating a stable rod-like structure. Side chains point outwards, away from the helix. In the beta-pleated sheet, hydrogen bonds form within the plane of the sheet, generating a stable sheet. Side chains point away from the plane, up or down. There are no obvious rules, where you’ll find alpha helices and beta sheets within a protein. Protein structure determination is the only way to confirm the presence or absence of secondary structures within a protein.
Releases energy ie occurs automatically