There is no chemical difference between adding salt early or late in the cooking process. However, if you salt just before eating, you can take advantage of textural differences between different types of salt. (Kosher salt is flakier and so gives a burst of saltiness that is quite pleasant.) (Some people will say that you should salt earlier to bring out flavors more, but once the salt is dissolved in solution, the chemical effect is the same.)
In general, fresh herbs tend to be added later in the preparation -- with the exception of parsley or dill added to soup early on to flavor the broth. However, if the herbs are added early, they must be removed, since they will lose all their flavor. (The broth will gain flavor, but the herbs will be exhausted.) You'll maintain the bright flavor if you add them late.
Dried herbs tend to react better to longer cooking, with bay leaves in particular requiring lots of time to render out their flavor.
As far as pepper goes, there's a fantastic answer to this question that goes into the chemistry of the volatile compounds in the spice. In general, I find that I prefer adding pepper later in the cooking process.
Garlic, ginger, onions, and other aromatics can be cooked a long time, although the flavor of alliums will change enormously as you cook them. (Garlic, in particular, will change enormously from a sharp flavor when raw or quickly cooked to a rich sweetness when cooked a long time.)