If you are repairing or adding to existing plumbing you must properly measure the existing lines, but if you are running new pipe, your local building code specifies what must be used. Typically, main lines are 3/4 to 1 inch, supply lines are 3/4 inch and fixtures use 1/2 inch.
Measure existing plumbing for repairs or additions by wrapping a string around the outside of the pipe and lay it flat and measure it. This gives you the outside dimension. However, most PVC pipes sizes require two dimensions, both the outside and the inside, which allows for wall thickness and dictates the fitting size. There is a cross-reference chart available at most hardware stores to assist you. If there is not one available, you may have to cut the pipe where it needs repair, or where you are adding on, and measure the distance across the face between the interior walls.
PVC pipes come in different grades for water pressure but usually schedule 40 is what is used in residential applications. Then you need to calculate the length that is required for the project by measuring the total run. The pipes extend almost the full distance inside of connection fittings, so add this amount on to your measurements or the lines may come up short.