Can you get surgery for hammer toe?

Absolutely. Surgery is the definitive treatment for hammertoe deformities that are rigid an cause pain. The procedure is relatively straight forward and the success rate is high.
Yes. It will involve removing part of the joint. Procedures and deformities vary so speak with a podiatrist.
Yes. If you catch hammertoes in the early stages, a small, in-office procedure to release one of the tendons will often allow the toe to lie straight again. If the toe deformity has become rigid, the surgery is more involved. It's an outpatient procedure in an operating room, and can involve bone cuts, pins, screws, or other implants. Without surgery, your best bet is padding to reduce your discomfort.
Yes. An incision is made overlying the contracted joint. The soft tissue attachments are released exposing the joint. The joint may be left separated or fusion of the ends may be attempted. For fusion, the cartilaginous ends of the bone are removed and the ends are approximated and stabilized via a wire, screw, pin, or implant. The contracted tendons may need to be cut or lengthened.
Surgery. As said - absolutely , and it is the definitive way to correct the deformity. There are different procedures depending on the nature of the deformity. See your podiatrist for an exam and x rays to find out more .