If you refinance and the loan-to-value is less than 80%, based on the appraisal at the time of refinance, then you would not have to pay PMI.
If you keep the existing loan there are usually pre-defined points where PMI is automatically removed. This should be disclosed in the paperwork. Usually it’s when the loan value is scheduled to reach the point where it falls to 80% of the original appraisal or purchase price. This usually is conditioned on some number of consecutive payments (no lates or missed payments).
As for bringing in an external appraisal and demonstrating that your existing loan is below 80% LTV based ona new appraisal … this usually requires cooperation from the lender and may also be spelled out in the loan documents.