Remove all trim from inside and outside the window using a pry bar to pull boards loose. Pry off any stop molding or other wood holding the window in the wall. Take off the bottom sill on the inside. Cut nails holding the window frame in place with a reciprocal saw; use a screwdriver to remove screws if they are used rather than nails.
Lift the old warped window out of the opening, working from the outside. Have a co-worker tap the top of the window with a hammer on the inside to knock it loose. Pull the top out first, tilt the window until you can grab it on both sides, then lift it out and set it aside.
Inspect the rough framing to make sure it has no rot, moisture or cracks and is not warped. Replace any frame elements that are too damaged to be used. Use a framing square to check the opening for square corners and a tape measure to determine the dimensions of the rough opening. Clean the rough opening of any dirt or debris.
Set the new window into the rough opening. Square and plumb it with a level, using tapered wood shims to adjust the edges. Drive shims between the rough frame and the window frame with a hammer, putting shims in from each side to adjust the window and secure it. Fasten the window to the rough frame with long screws; some windows have connections on the inside of the jamb, others have exterior mounting plates that are fastened to the studs.
Test the window to make sure it opens and closes properly. Install metal flashing with flashing nails around all edges to seal out moisture. Replace the exterior and interior window trim, with new trim wood if the old was warped or damaged in removal. Set the top and side trim first, the bottom or sill trim last. Caulk around all trim pieces to seal them from water.