Imagine a house without molding, nasty! Good thing some smart people invented the idea to put a piece of wood between the floor and wall.
(By the way, on my search for baseboard photos, I found this crazy modern house, slick!)
Most houses these days have baseboards and quarter round molding for that purpose.
AmbientBP has a great illustration:

(Ignore the hidden gap, that’s usually floating floors, which is a topic for another day)
Anyhow, once they’re installed, they’re pretty hard to get out.
In almost all cases, framing nails are blasted in with a framing nailer, which is recessed into the molding and almost invisible after the right color of putty is put on.
First of all, decide whether or not you want to save the molding or not. In most cases, the molding in all the rooms are matching. So if you can’t find replacement molding in the same style, then you should try to save it, especially for older houses. In my case, I just didn’t feel like buying new molding when the existing ones were fine, and just needed a bit of refinishing.
So, the best way to get it out safely is with the good ole pry bar, specifically a pry bar designed for molding.
1. Get the quarter round out, slide a putty knife underneath to give room for the prybar.
2. Sometimes the nails will rip right out with the quarter round, or may rip right thru, don’t worry about that. (Wood filler to the rescue!)
3. Once all the QR is out, you can finally get to the baseboards.
4. Start reading here.
If you’re like me and you have plasterboard walls, knowing plaster repair would be nice. Otherwise, you can be ghetto like me and just fill it with joint compound (i.e. heavy duty version of spackle.)
With all the molding out, you can easily refinish it somewhere more convenient, like a garage, whee.