A statistical thermodynamic approach is used to analyze the various contributions to the free energy change associated with the insertion of proteins and protein fragments into lipid bilayers. The partition coefficient that determines the equilibrium distribution of proteins between the membrane and the solution is expressed as the ratio between the partition functions of the protein in the two phases. It is shown that when all of the relevant degrees of freedom (i.e., those that change their character upon insertion into the membrane) can be treated classically, the partition coefficient is fully determined by the ratio of the configurational integrals and thus does not involve any mass-dependent factors, a conclusion that is also valid for related processes such as protein adsorption on a membrane surface or substrate binding to proteins. The partition coefficient, and hence the transfer free energy, depend only on the potential energy of the protein in the membrane. Expressing this potential as a sum of a 'static' term, corresponding to the equilibrium (minimal free energy) configuration of the protein in the membrane, and a 'dynamical' term representing fluctuations around the equilibrium configuration, we show that the static term contains the 'solvation' and 'lipid perturbation' contributions to the transfer free energy. The dynamical term is responsible for the 'immobilization' free energy, reflecting the loss of translational and rotational entropy of the protein upon incorporation into the membrane. Based on a recent molecular theory of lipid-protein interactions, the lipid perturbation and immobilization contributions are then expressed in terms of the elastic deformation free energy resulting from the perturbation of the lipid environment by the foreign (protein) inclusion. The model is formulated for cylindrically shaped proteins, and numerical estimates are given for the insertion of an α-helical peptide into a lipid bilayer. The immobilization free energy is shown to be considerably smaller than in previous estimates of this quantity, and the origin of the difference is discussed in detail.