Not a car dealer here, but know a bit about it.
A few general keys to success
1) you need equity in your car to have any ability to pay off your current car and purchase a different car without a loan.
2) You need to know the value of both what you're buying and what you're trading in. Dealers are great at mixing the transactions confusing the issues and having you come out behind.
The actual way it works is similar to any other trade in. lets say you trade in a BMW for $45K, you have a loan of $25K on it for a used Forester priced at $15K. The transaction gets written up like any other car sale with a trade in amount. $20K(45k- $25K loan) gets applied to the Forester purchase, wiping out the balance owed, and they cut you a check for $5K
3) I'll be honest, if you're talking about the car in your profile, I think you're going to have a hard time making this happen. The value is likely too low for you to both owe enough that you need to come out from under it and have enough equity to purchase another car outright from a mainline dealer. You'd likely be at a random unaffiliated used car dealer, which can be Ok, but a lot of them are sketchy.
I feel like the best $ move would be to sell the car privately paying off the loan and buying something cheap on craigslist.