Before/during/after! The entirety of the care delivered will effect scar. This includes age, associated medical diseases, history of tobacco use, nutritional status as well as surgical technique and skill will effect the ultimate scar appearance in addition to post operative measures such as well optimal tissue oxygenation, blood pressure, swelling, wound tension, wound care, timing of suture removal & close follow up.
Time is essential. Any wound, whether surgical or from trauma, takes time to heal. The scar will go though different phases of wound healing that all take time to complete. The best things you can do to promote healing is eat a good, high-protein diet, apply moisturizer or other hydrating scar creams, and avoid uv or sun exposure without using a broad spectrum sunscreen with spf > 30.
Various options. While every patient scars differently, and genetics has a huge role in what kind of scarring is produced, various options exist to help healing. Gentle massage and pressure over the healing scar, especially when in the shower, has been shown to help. There are a number of products on the market that promise “no scar”, but none of these are definitively proven to work in everyone, all the time.
No smoking. I forgot to add to my previous answer that you need to avoid smoking and tobacco in all it's forms.
Scar Management. http://drnichter.com/best-scar-management/
First, make sure... ...That the wound edges do not have too much tension on them. (a good cosmetic surgeon will make sure there is not, but ask anyway.) keep the incision(s) clean and dry. (infections are a major cause of bad scarring.) applying a silicone "scar sheet" (available otc at most pharmacies) at bedtime may help as well, although evidence for this is not entirely convincing.