The price of a machined part is calculated for your part and your quantity. These are the factors that move it the most.
Material comes first. Your part is made from a commercial bar or plate slightly larger than the part, so the price accounts for that size and the type of material. Aluminum machines faster and costs less than stainless steel or an engineering plastic.
Geometry sets the machine time. Deep cavities, internal corners with small radii, thin walls or features on several faces of the part require more operations and more manufacturing time.
Tolerances matter too. A dimension tighter than the general tolerance requires additional finishing passes and inspection, so it is best to reserve them for the functional dimensions of your part.
Finishes, threads, inserts and marking are additional operations, each with its own cost.
Finally, quantity. The price per part drops as quantity goes up.
See CNC part examples with real pricing at 1, 25 and 100 units, and each factor in detail in what affects the cost of a machined part.