I'm going to suggest something:
Don't. I have nail polish in my hair now. And that shit don't come out. But if you must, read on.
Don't use good nail polish. Do not use your favorite bottle. Buy your dog some, and buy colors that won't blend in. Don't get colors close to the current shade of their nails or coat. Pink, red, blue and green are good options. Reasoning? I have dog hair in my nail polish now. Enough said.
My dog is only a year or so old, and she gets very excited when she sees anyone. She's also a border collie crossed with a kelpie. They are both work dogs. They are meant to chase sheep, or cows. Read: she has a lot of energy. Please, for your own sake, pick a dog that is quiet and sensible and happy to sit still for a while. He or she should also be comfortable with you touching it's feet. If they do not like that sort of contact I suggest you refrain from painting its nails.
Tie your dog up. Unless your dog can stay perfectly still for a while tie it up. And do all of this outside, please. A dog that moves around and so knocks over a bottle of nail polish is a very bad dog, but not as bad as you would be stupid for not picking an area that can have red polish everywhere.
Make your dog sit. You can do this with any number of treats, restraints or drugs, just as long as the dog is in a position from which you can comfortably take away a paw at a time from its support.
Undo the lid of the bottle, get a decent amount of polish on the brush and place the bottle out of reach of the dog. Take a paw. Paint the nails. Repeat for each leg.
Now that your dog is pretty, why not spice up his or her fur? Glitter spray, colored hair spray and/or various doggy clothes would be excellent choices! I knew a dog that had a purple tail tip, a pink and glittery bandanna around her neck, and nail polish. She was a working sheep dog, too.
Now that's class.