The chair conformation of six-membered rings have a dihedral angle of 60° between adjacent substituents thus usually making it the most stable conformer. Since there are two possible chair conformation steric and stereoelectronic effects such as the anomeric effect, 1,3-diaxial interactions, dipoles and intramolecular hydrogen bonding must be taken into consideration when looking at relative energies. Conformations with 1,3-diaxial interactions are usually disfavored due to steric congestion and can shift equilibrium to the other chair form (example: C to C). 
The size of the substituents greatly affects this equilibrium. However, intramolecular hydrogen bonding can be an example of a stabilizing 1,3-diaxial interaction. Dipoles also play a role in conformer stability, aligned dipoles lead to an increase in energy while opposed dipoles lead to a lowering of energy hence a stabilizing effect, this can be complicated by solvent effects. Polar solvents tend to stabilize aligned dipoles. All interaction must be taken into account when determining a preferred conformation.
Conformations of five-membered rings are limited to two, envelope and twist. The envelope conformation has four atoms in a plane while the twist form only has three. In the envelope form two different scenarios can be envisioned; one where the ring oxygen is in the four atom plane and one where it is puckered above or below the plane. When the ring oxygen is not in the plane the substituents eclipse and when it is in the plane torsional strain is relieved. Conformational analysis for the twist form is similar thus leading to the two forms being very close in energy.