How does hip replacement surgery usually work?

Very well! Seriously, hip replacement refers the procedure in which the "ball and socket" are replaced with a metal and plastic prosthesis. The surgery is done over 300, 000/year in the USA alone and the results are excellent. The recovery is relatively quick and the relief is almost immediate for many.
The basics. The worn down ball on the top of your femur gets removed. A shaping tool (broach) is passed down inside the top of the femur, preparing it to receive a metal wedge-like implant, the attachment site for a new smooth metal ball for the femur. The pelvis has a bony hole (the socket) that holds the ball & is re-shape to accept a metal and plastic socket for the new ball to smoothly rotate in.