Michael is correct that the airline's website will usually tell you how many redeemable miles, elite-qualifying miles, and elite-qualifying dollars you'll earn on a particular trip. As shown below, in Delta's case, this occurs on the flight check-out page instead of the flight selection page.
I would additionally note that elite-qualifying dollars are normally based on the fare alone, not including taxes and fees. As you can see from this example on Delta, the flight costs $90.20 total, composed of $70.70 in fare and $19.50 in taxes and fees. Yet, only 71 MQDs (Medallion Qualifying Dollars) are earned.
Additionally, 'extras' that may be purchased often don't count towards elite-qualifying dollars (as you can see from the highlighted PQD numbers in Michael's answer not changing when purchasing extra packages.) Which 'extras' do or don't count varies by airline. For example, as Michael's answer shows, upgrading to an economy+ seat does not count for PQDs on United. However, on Delta it does count, as shown below:
This is the same flight, but in economy+ (which Delta calls "Comfort+") instead of economy. Since the upcharge for economy+ is considered part of the fare by Delta (except for the taxes on the upcharge,) the flight earns 89 MQDs instead of 71.
It's also probably worth noting in the example here that 500 MQMs (Medallion Qualifying Miles) are earned for this particular flight. This is not a coincidence; those cities aren't actually 500 miles apart. Instead, Delta credits a minimum of 500 MQMs for any particular flight segment on Delta metal. Even if the flight is only 50 miles, you'll still earn 500 MQMs.
Additionally, airlines normally have a bonus multiplier for elite-qualifying miles (but not dollars) if you're traveling in a premium cabin. For a discount Business or First fare, the bonus is 50% in Delta's case, so you'd earn 750 MQMs on this flight if flying in First: