At most restaurants that I've seen, the middle of the table is set up with:
- One salt shaker
- One pepper shaker
- A small dish of a few sugar packets
Why isn't sugar put in a shaker like salt and pepper are?
Because, at the table, a shaker is entirely the wrong dispenser for sugar.
Shakers are used to sprinkle small amounts of a substance over an area, which is exactly what you want for salt and pepper. Sugar is used to sweeten drinks by adding a relatively large amount, which is just dumped in the drink and not spread over an area. If you tried to do that with a shaker, it would take forever and you'd end up with sugar all over the place.
Note that, in the kitchen, one might use a shaker. Pastry chefs often use shakers to dust things with powdered sugar or flour.
Salt and pepper are (generally) used in smaller amounts.
A sugar packet also is a sort of measuring unit; it's roughly as much as a sugar cube. That means that you can use it for coffee and tea without having to pay attention to how much you use.
Sugar clumps faster than salt and pepper do, I think, so you don't want any tea/coffee steam to clog up the shaker. Maybe packets feel more sanitary for this reason, too?
Note that there are sugar shakers in existence, at least in Europe. They're just not as common.
It's to do with a combination of the granularity of the substance you're using, and the amount that you want to use.
Table salt and (ground) pepper have fairly small granules, and so flow well from a shaker, and you usually use a fairly small amount of them. So a shaker is a good solution.
Sugar typically has larger granules, and hence flows poorly. In addition people tend to use a lot more sugar than they do salt. So a shaker is a poor solution. A sugar dispenser or a sugar pourer is a good solution as it allows for larger amounts of sugar to be dispensed as well as larger pouring spouts, which facilitate pouring of substances with larger granules.
Types of sugar that are finer, and used in smaller amounts often come in shakers. As an example the type of sugar used on pastries such as Dutch poffertjes is typically in a shaker.
Typically, salt and pepper are applied uniformly over a meal.
Sugar on the other hand is mostly used to supplement tea or coffee in solution. As such, the precision of the application of the condiment is much less important. It will just be stirred in later.
There is a misconception in the question in the idea that sugar would even be in a shaker at a restaurant table. The sugar you see on a table at a restaurant is not the type of sugar you'd ever see in a shaker. As other's have pointed out, confectioners sugar would be in a shaker, but there's no need for confectioners sugar at a table. You have granular sugar at the table.
There's also an overgeneralization in the question in that you see sugar in packets in 'most' restaurants. Many restaurants still have sugar in pourable containers as they are designed for the purpose of putting into tea or coffee. These are called sugar pourers:
The reason it's both larger and acts as a pourer rather than shaker is due to how we use sugar: we typically use a lot more of it, and pour it into our drinks (as opposed to shaking it minimally over our entire plate ala salt and pepper).
As for why packets of sugar exist, the answer is likely entirely due to cost. The reasons why it may be cheaper to use packets:
In summary, the reason that sugar isn't in a shaker like salt and pepper is because we use it in entirely different ways than salt and pepper. As for why sugar packets are common is mostly purely business financial reasons--not user experience design.
People tend to use much more sugar than salt and pepper.
People usually know how much sugar they take in their coffee or tea. "I take my coffee with two sugars". No one has a set number for the amount of salt and pepper they use, because unlike coffee and tea, food is generally seasoned by the chef before it reaches your table. You might get a steak with very little seasoning, and you would need to add a lot of salt and pepper. But the next time you get a steak, it might be perfectly seasoned, and adding the amount of salt and pepper you used last time will ruin it. A coffee (at a diner, not a coffee shop) comes with no sugar, so you always know how much to add.
Putting sugar into a salt shaker would make it impossible to use in a reasonable way. People measure sugar in full teaspoons. It would take 30 seconds at least to fill a teaspoon with sugar from a shaker. I take 3 sugars in my tea, so I would have to spend a minute and a half sugaring it.
Kids tend to play with everything on the table, and playing with sugar makes a horrible mess. Sticky sugar residue is gross and attracts ants.
If you put sugar in a salt shaker, it would be useless the first time the weather turned humid. Sugar clumps up even faster than salt.
Packets of sugar contain a specific amount of sugar, making it easy to use. They are also are more hygienic. The product is kept away from meddling hands, and remains granular, as opposed to forming a single giant clump.
Despite all the reasons listed above, the fact remains that sugar pourers do exist.
It's so you don't mix them up.
Salt and sugar look identical to the naked eye. When you would put both in shakers and place them next to each other, guests could mix them up, leading to horrible culinary results.
Sure, you could make them discernible by labeling them or giving them a different design, but then every household and restaurant would use a different convention to tell them apart, easily confusing people, especially when they are distracted.
A shaker is designed to add seasoning onto the top of food. Sugar, is only really used like that when in powdered form (confectioners sugar) and is specific to a few deserts. The packets, like those at restaurants, are designed specifically to add sugar to drinks. The clump of sugar coming all at once, breaks the surface tension of the drink and allows the sugar to become submersed in the liquid for optimum diffusion. It would also take far longer to measure out the required sugar for a drink using some sort for shaker.
I worked in a dessert restaurant for a few months in college. We had sugar shakers on the table, one powdered and one sugar cane. This is more of a usability issue.
Sugar becomes rather... I am not sure of the exact word but... dirty. A little moisture and hands on the shaker and the top of the shaker looks like ass. We had to wipe the sugar shakers during shifts and the tops were washed a lot.
Compare that to salt and pepper which dries out cleaner and this is a no brainer. You can have your ketchup fingers all over the salt shaker and the damn thing cleans itself. Touch the sugar shaker top and then the next table holds it like they have a poo in their hand and asks for a new one. The sugar pourers solve this issue. However they are not attractive and cannot help people sprinkle so most places opt for packets.
I quickly read through these answers and, though admittedly I may have missed something, I did not see one single mention of the real reason why sugar is not put in a shaker:
Your sugar is not in a shaker for one reason above all other (still legitimate) reasons mentioned above: because every one of those little colored paper packets is an advertisement for a highly successful manufacturer of sugar (often Domino), and sugar substitutes (e.g. Sweet n Low, Splenda, Stevia, etc.). Because if you put sugar in a shaker you'd still have to have the paper packets for the large quantities of people who prefer the myriad alternatives, and each one has a pretty large audience who oftentimes will only accept their preferred brand of chemicals.
This NY Times article includes some helpful info on the value of the sugar substitute industry and brand loyalty among consumers within that industry: http://www.nytimes.com/2009/04/15/dining/15sweet.html?pagewanted=all&_r=0
So now each table is saddled with THREE shakers PLUS the little ramekin of sugar substitutes, and as a restaurant owner you're in a quandary as to how much table space can be justifiably devoted to dry seasonings (especially since a lot of places that leave these things on the table are also the places that will either leave things like ketchup and mustard on the table or will likely bring it with your food).
Here's a Slate article where a chef discusses removal of salt and pepper from tables due to "table real estate": http://www.slate.com/blogs/browbeat/2013/08/15/salt_shakers_at_restaurants_the_double_standard_between_bellanico_and_boston.html
So no, it's not just that sugar is dirtier or that the uses are different than salt and pepper in terms of how you disperse it (though those are valid and logical reasons). It is, as in many things in life, a money thing.