Foot deformities are complicated. They are a result of the mechanics present in your foot which stems from your foot type. Your foot type is a way to describe the position of your foot when standing and when your foot compensates for altered positioning or changes in motion within joints. When you have foot conditions corrected for with surgery, many of these deformities can recur unless there is adequate control and correction performed post-operatively.
Hammertoes are the result of a muscular imbalance in the foot, whereby the tendons controlling the motion of the toes are overworked and can become tight. When these tendons are constantly over working to stabilize your foot with walking and activity, they can physically shorten which makes the deformity of the toe semi-permanent (we say semi-rigid). If the condition continues beyond this point, the joints can actually adapt to the position and may even begin to arthrose (or fuse) into that position. When hammertoes are corrected for, the abnormal joints can be re-aligned, fused into a corrected position or splinted in hopes that scar tissue will hold the toe in a normal position. If that doesn't seem complicated enough - the deformity in the toe is not ONLY IN the toe, but also the joint where the toe connects to the foot.
When a hammertoe is present and the toe is cocked up where it meets the foot, the condition is even more complicated. There may be a chronic tear in the ligament which would normally hold the toe down, if not, it is likely attenuated (or very stretched out). In order to correct for the hammertoe and try to prevent the toe from drifting back upwards, a bone cut is sometimes required to slightly shorten the bone behind the toe which takes tension off of the tendons and also allows your surgeon to assess for any tears which require repair intraoperatively.
After surgery, the joint capsule and tendon will often still need some convincing to stay in their new position. After all, they have likely been in the wrong position for years and therefore the tight tissues need to loosen and stretch. Similarly, the loose tissues need to tighten and become stronger. For this reason, your post-operative course is of the utmost importance. There are many special implants on the market for correction of hammertoes, but often a pin in the toe after surgery is the best way to go. These pins stay in place for about 4 weeks, while your foot gets used to its new position. Bunions are a different animal in terms of the exact deforming forces and causes. However, the same is true with regards to the importance of the post-operative course.
Even after a person has healed completely from surgery, it is vital to control the foot's position and function and minimize the forces that can cause recurrence. In most instances, this means that custom orthotics are required. Wearing flat unsupportive shoes, or even supportive shoes that cannot control your biomechanics is a sure fire way to see recurrence of your foot deformity. Short of reconstructing the entire foot, there is no better way to correct the deforming forces in your foot other than custom orthotics.
In short, the answer to your "now what" question depends on a few things. First, if the recurrence is painful and you are again having limitations in your daily activity goals, surgery may be discussed again. In cases of both bunions and hammertoes, sometimes a similar procedure can be performed. However, more definitive procedures are often of great benefit. A recurrent bunion which demonstrates a lack of motion is often better fused into a corrected position to prevent further recurrence and need for surgery. Similarly, hammertoes that were previously corrected without fusion of the deformed joint may require this the second time around.