To make hydrangeas blue, you must add aluminum sulfate to the soil (if it does not occur naturally) to make the soil more acidic. Making them pink, however, is much easier, as pink hydrangeas require a low pH, and for the majority of the United States with limestone bedrock, alkaline soils are normal. If you have alkaline soil, you probably only need to plant them to have pink hydrangeas, but if your soil is acidic, adding lime and high phosphorous fertilizer is a must. For that reason, hydrangea color is much easier to control in containers than in the ground. (See reference 1.)
Test your soil with a good pH test kit or by sending a sample to your area extension service or soil and water department lab for analysis. If it tests alkaline, you have only to plant the hydrangea--it will be pink automatically. Soils that are pH 6.5 or higher will usually produce pink hydrangea flowers, according to United States National Arboretum (see reference 2), but Make Mine Pink cautions not to exceed pH 6.4 or you may risk iron deficiencies in your plant. They recommend trying for a pH around 6.0 to 6.2 (see reference 3).
Plant the hydrangea in the ground to the depth it occupied in the container that you purchased from the nursery.
Water it thoroughly so the soil settles closely around the roots. Do not overwater--too much may rot the roots. If your soil tests acidic, go on to the next step.
Add portions of dolomitic limestone and high phosphorous fertilizer to the soil at the rates recommended on the label by the manufacturer. (It is especially important not to overdo the recommended amounts if you are planting in a container.)
Keep the soil moist until the hydrangea becomes well established, adding further soil supplements as needed to retain the color.