Dry lavender when the buds are closed just before the blossoms open as this will keep more of the essential oil in the flowers as they dry and will give a longer lasting perfume. Time of day affects the amount of oil in the flowers as well - early morning picking gives a 'milder' scent. Various differnt types of lavender also have preferred uses - some better for drying, others for cooking
Dry either on a rack on a flat surface, or tie into bundles and hang upside down in a dry dark cupboard. No set time - when the flowers and stems are dry - they are ready for use.
Check for any with mildew that can appear and spoil the stems.