Upfront pricing is calculated based on a combination of estimates such as the trip time and distance from pickup to dropoff, demand patterns for that route, and any applicable taxes, surcharges, and fees.
The price may change if you add stops, update your dropoff, pass by toll gates, if the route changes significantly due to things like traffic or road closures, or if the Captain waits longer than the initial grace period. When this happens, your final price is calculated based on the actual time and distance of the trip.