Hello magdyfayad;
A whopper of a question!
Trial and error is still used in many situations, especially when the system is controllable, self-regulating and you are experenced with the process. And you have time. And when you don't mind coming back everytime the process parameters have changed...
Non-mathematical (graphic analysis) methods inclde Ziegler-Nichols, Cohen-Coon.... These are very useful if you have access to the controller, process and a data recorder long enough to do a few open-loop tests; generally management frowns on this during production (this means long nights, much coffee, and a deadline linked to the shutdown time allowed). Once you have your data, simple graph data and standard calculations will provide values for your PID constants. These values are not optimized though. They are, at best, a good approximation, and must be tweaked after insertion in the algotithm.
Here is a link to a site that explains Ziegler-Nichols tuning techniques:
http://www.jashaw.com/pid/tutorial/pid6.html
Finally, you have mathematical tuning techniques, that involve modelization and differential equations (Laplace Transforms). They can get quite involved as you could see if you search for threads opn this site that were initated by Pandiani and Peter Nachtwey; very informative, very deep, sometimes scary...
Have a look at controlguru.com for papers on modelization, tuning, and process analysis.
Hope this helps,
Daniel Chartier