The three refund situations
Form 2290 tax is paid up front for the whole July–June period, but three situations earn it back: the vehicle is sold before June 1 and not used afterward, it is destroyed or stolen before June 1, or it finishes the entire period at or under the mileage limit (5,000 highway miles; 7,500 for agricultural vehicles). The first two are prorated by full months of use; the third refunds every dollar — but only after the period closes on June 30.
The money comes back one of two ways: as a credit on line 5 of your next Form 2290, or as a cash refund claimed on Form 8849 with Schedule 6. Either way the computation is the same, and the estimate above uses the identical month-counting method as the IRS partial-period tables.