Self-sealing tubes are filled (well, not completely filled) with a sealant, similar to this used to seal tubeless tyres. When a wheel is spinning, sealant is distributed evenly around the tube, and when the puncture occurs, the sealant should be able to stop the air from leaking. They are quite reliable for small punctures (say, up to 5mmm at a time) but the sealant may lose its properties after a few months so I'd be careful with these.
And whether you need to remove the puncturing object, well it depends. If it's small and could progres into a tube it's better to remove it immediately before the hole increases. And when it's large (say, a larger nail) it could sometimes help stop the leak. However there's no strict rule here, and you have to check what works better in each situation.