To make by hand, combine the flour, salt, and sugar, if using, in a large bowl. Work the butter into the flour with a knife, pastry cutter, or your fingers until the mixture resembles coarse meal. Sprinkle the ice water onto the crumbly dough and, with your hands, push the dough from the sides to the middle of the bowl to form a ball that holds together. Transfer to a work surface. Cut the dough in half, place half on top of the other, and press down. Repeat the cutting and pressing steps three or four times until all of the water is incorporated into the dough and it clings together.
On a floured surface, gently flatten the ball of dough with a rolling pin. Starting from the center, roll the dough into a circle about an inch larger than the diameter of the pie pan. Lift the dough into the pan. Fold the edges under and crimp with your fingers or a fork.
To make in a food processor, cut the butter into 1inch pieces and place them in the bowl of the food processor. Add the flour, salt, and sugar. Process until all of the ingredients are incorporated. With the processor on, add the water a tablespoon at a time until the dough begins to clump but is still crumbly. Continue to drizzle a little water and pulse the food processor, stopping to test the dough with your fingertips to see if it is moist enough to hold together.
When you can gather the dough into a ball, remove it from the processor, place it on a lightly floured surface, and roll out and fit into the pan as above.