I have a habit of replacing trim in the houses I live in. Our new house is no exception. Although installing trim involves more than just caulking, caulking itself makes the project look fantastic and is really pretty simple.
First, use caulk that is made for trim (also listed as moulding, doors, windows).
Then, apply the caulk as messily as you want with a caulk gun:
Next, wet your finger and run it along the caulk bead, pushing it into whatever crevice you are caulking:
Finally, use a wet sponge to clean up any excess caulk. For this step, I like to push my finger towards the wall (as opposed to the trim) and wipe up any excess caulk. You may need to make a couple passes, and keep the sponge reasonably clean:
Now the trim, and caulk, are ready to paint. Easy! (but still time consuming)