The lien and the notice of the lien are two separate things, and almost every confusion on this subject comes from merging them. The lien itself is automatic. The IRS's own description of when it exists is a three-part checklist: the agency "puts your balance due on the books (assesses your liability)", "sends you a bill that explains how much you owe (Notice and Demand for Payment)", and the taxpayer "neglect[s] or refuse[s] to fully pay the debt in time." Nothing is filed and nobody is served. Section 6322 then relates the lien back to the assessment date.
The Notice of Federal Tax Lien, Form 668(Y), is a public document the IRS files at a recording office, and its purpose is priority, not existence. Section 6323(a) says the lien "shall not be valid as against any purchaser, holder of a security interest, mechanic's lienor, or judgment lien creditor" until a conforming notice has been filed. So the filing decides who wins against a bank or a buyer; it does not decide whether the government has a claim. The consequence people get wrong: withdrawing the notice does not remove the lien, and paying the debt removes the lien whether or not a notice was ever filed.
Filing the notice starts a hearing clock, and it is short. Section 6320 requires the IRS to notify the taxpayer in writing of the filing "not more than 5 business days after the day of the filing of the notice of lien", and gives a right to request a hearing "during the 30-day period beginning on the day after the 5-day period". The hearing is held by the IRS Independent Office of Appeals before an officer with no prior involvement in the case, and the taxpayer may raise collection alternatives, spousal defenses, and, if they never had a chance to dispute it, the underlying liability itself. The IRS calls this Collection Due Process, which is its administrative label; the statute's own words are "notice and opportunity for hearing." Section 6320's notice must also mention section 7345, under which a seriously delinquent tax debt can be certified to the State Department and cost the taxpayer a passport.
Four exits, four different effects. Confusing them is expensive, so the IRS's own definitions are worth keeping straight.
Withdrawal is the one worth understanding, because section 6323(j)(1)(B) makes entering an installment agreement a ground for it. The IRS's 2011 Fresh Start administrative criteria for that route, as published on IRS.gov, are that the taxpayer owes $25,000 or less, that a Direct Debit installment agreement will full-pay within 60 months or before the collection statute expires, whichever is earlier, that three consecutive direct debit payments have been made, and that the taxpayer is otherwise in compliance and has not defaulted on a direct debit agreement before. Those are administrative figures, not statutory ones, so they can move without an Act of Congress; the statutory authority is 6323(j) and does not depend on them.
The credit-report answer changed in 2018, and most writing on this subject did not. The three nationwide consumer reporting agencies removed civil public records under the National Consumer Assistance Plan. The Consumer Financial Protection Bureau's review of the outcome, published in December 2019, records that "almost half of tax liens survived the July 2017 removals, but by April 2018, none remained", and that "bankruptcies are now the only type of public record on credit reports", the reports in question being those of the three nationwide agencies. Two limits keep this from being the whole answer. The CFPB noted in a footnote to the same sentence that "other consumer credit reporting agencies continue to offer lenders access to civil judgment and tax liens", and a filed notice remains a public record at the recording office, which is where a title search and a commercial lender find it. So the honest statement is that a filed lien no longer shows on a standard consumer credit report, and still very much shows up when someone buys, sells, or borrows against property.
A federal tax lien is not defeated by bankruptcy in the way people expect. The IRS states that "if you file for bankruptcy, your tax debt, lien, and Notice of Federal Tax Lien may continue after the bankruptcy." That is the same result the general lien page describes: a discharge erases personal liability while the lien stays attached to the property.