Don't be tempted to painting over the nail holes. They will definitely show through. Fill all of your nail holes with some quick drying spackle. Your finger is the perfect tool for this job, you'll move quickly through all of those holes.
Next, caulk. First step make sure that you choose a paintable caulk. That is one of those mistakes that you will only make once! Use the caulk to fill all of the gaps along the different molding elements as well as any once the spackle and caulk have dried, you need to lightly sand the entire molding to be sure that it is super smooth for your paint. I like to use a sanding sponge because it easily conforms to all of the different heights on the molding.
Wipe the moldings down and look for any spots you may have missed. Make final touch ups and you can move onto the paint.
A sash or trim brush is the best choice for moldings. The angled bristles give you a nice clean line as you work. Prime and then paint. Not sure you want to prime? Not only will the wood take the paint better, but it will seal any knotholes so they don't bleed through the paint. I'm Mrs. Fixit and it's just that simple!