First of all, you should be prepared:
- You must know which things you are allowed to bring, and which are prohibited.
- You must know the quantity for the things you are carriyng - for some of them (like alcohol) there are restrictions.
- You must know about quarantine rules - for the meals, animals, and so on.
- You must know about local culture - for example, not every customs personnel in Russia likes the smiles.
- I think there is more things you must know about.
For second, you should be smart on customs - check every possibility to minimize your time. For example, customs have 4 windows to get passengers through, but most part of people goes only through 3 of them, and no one notices the fourth.
Get your luggage with you, and avoid heavy and massive things - more volume brings more problems.
For third, be polite and know your rights. Good luck.