It's an art to do it right, I used to have it done for me but for $500 a car I decided to try it myself, I'm decent but not a pro.
For scratches hand sand them out with 600 grit paper, for dents tap them out with wood or a trim hammer then use a flat file to take the high spots off followed by 600 grit. then buff with a coarse wheel and then a soft wheel with proper abrasives. I do the best I can and if it isn't good enough I watch ebay for a better peice to replace mine with. like I said it's an art buy with some time and practice you can probably get it good enough to satisfy yourself. nothing ruins a nice car faster than crappy looking trim in my opinion.