Depending on where you live, rosemary is a perennial. In Pittsburgh, it is typically grown as an annual because of our cold winters.
Harvesting Tips:  1) My rule of thumb is to harvest rosemary stems based on what you need once the plant is established. 2) It is best to harvest in the morning or evening when it is cooler. 3) Soak the leaves and stems in a bowl of cool water to get rid of any bugs and dirt.
Short Term Storing Tips:  4) After the leaves dry, you can store rosemary in the produce drawer for a few days in a plastic or glass container. Another options is to remove the lower rosemary leaves from the tender stem and put the stem in a glass of water on the counter.  You should change the water daily.
Long Term Storing Tips:
Freezing Tips: 4) After you clean the rosemary and the leaves dry, individually freeze the tender stems along with the attached leaves.  Another option is to remove the leaves and freeze them in water, broth or olive oil in herb or ice cube trays depending how you are going to use them in the future. 5) Put the frozen rosemary stems and leaves or rosemary cubes in an airtight container in the freezer. If you don’t freeze the stems, then put them in your compost bin.
Drying Tips: 4) After you clean the rosemary and the leaves dry, tie twine around the stems of a bunch of rosemary (you can do this step when the stems are tender or woody) and hang upside down until dry. 5) After your remove the leaves from the stems, crumble the leaves. 6) Store the dried rosemary in glass containers and put the stems in your compost bin.
When removing the leaves, you can do it by hand or use an herb stripper.
I like to freeze the tender stems and leaves of rosemary whole for our poultry dinners like turkey at Thanksgiving and dry the leaves on the wood stems.