If they can, how do they distinguish twins? By their smell? By their dressing difference? Or by other mechanism?
That's an easy one. The definitely can. Think about all the training shows and articles, tell you how easily dogs can pick up on human body language, even when the human doesn't mean to project it.
Twin's aren't really identical. Anyone who knows a set of twins can tell them apart. Granted if they're being sneaky, they can emulate something about the other, such as their dress or a quirk and fool some people, but it's much easier to fool people than dogs. Not only will their mannerisms be different, but their smell will be as well. I don't think people realize all the different things they do that make them unique to a dog.
Lets go with the twin example. You have two identical twins. One likes to eat a pop tart for breakfast every morning and the other like toast. To a dog, those smells stick to you most of the day. Also, if you eat enough of a certain type of food, it begins to ooze out of your pores. Another example would be where the person works. You pick up different smell depending on where you work. If one works at an office, the dog will pick up toner scent, and if the other works at a restaurant, the dog will pick up that smell. Maybe one twin likes to swim and chlorine smell is sticking to them most of the time.
You can see my point, that twins are going to move and smell different all the time. And to be honest, I think a dog would probably be able to tell twin babies apart pretty readily.