At the core of amyloid fibrils is the cross-beta spine, a long tape of beta-sheets formed by the constituent proteins. Recent high-resolution x-ray studies show that the unit of this filamentous structure is a beta-sheet bilayer with side chains within the bilayer forming a tightly interdigitating steric zipper interface. However, for a given peptide, different bilayer patterns are possible, and no quantitative explanation exists regarding which pattern is selected or under what condition there can be more than one pattern observed, exhibiting molecular polymorphism. We address the structural selection mechanism by performing molecular dynamics simulations to calculate the free energy of incorporating a peptide monomer into a beta-sheet bilayer. We test filaments formed by several types of peptides including GNNQQNY, NNQQ, VEALYL, KLVFFAE and STVIIE, and find that the patterns with the lowest binding free energy correspond to available atomistic structures with high accuracy. Molecular polymorphism, as exhibited by NNQQ, is likely because there are more than one most stable structures whose binding free energies differ by less than the thermal energy. Detailed analysis of individual energy terms reveals that these short peptides are not strained nor do they lose much conformational entropy upon incorporating into a beta-sheet bilayer. The selection of a bilayer pattern is determined mainly by the van der Waals and hydrophobic forces as a quantitative measure of shape complementarity among side chains between the beta-sheets. The requirement for self-complementary steric zipper formation supports that amyloid fibrils form more easily among similar or same sequences, and it also makes parallel beta-sheets generally preferred over anti-parallel ones. But the presence of charged side chains appears to kinetically drive anti-parallel beta-sheets to form at early stages of assembly, after which the bilayer formation is likely driven by energetics.