Total knee replacement surgery is a major undertaking. While it has the potential to radically improve your life, be realistic about the difficulty of recovery---and the time and work it will take---to get back to a functional level. One of the main challenges of recovering from knee replacement surgery is regaining your range of motion. You'll have to work conscientiously at being able to straighten out your leg after a total knee replacement.
Begin with a high-quality physical-therapy program. You cannot make a beneficial recovery from knee replacement surgery without going through a regimen run by professional physical therapists recommended by your surgeon. Set this up before you leave the hospital.
Sit with your feet flat on the floor in front of you, and your knees bent loosely. Wrap a towel around the ankle of the stiff leg and hold the towel at both ends, forming a "band" around the ankle. Keeping your foot flat on the floor, slowly bring your heel in toward your rump as far as you can, inch by inch. Then slide your heel back out to the starting position and repeat. Do about 10 repetitions on each leg.
Still sitting on the floor, slowly slide your heel out and press your knee down toward the floor, straightening it as much as possible. Use the towel to help you slide the leg back to a loosely bent starting position. Repeat about 10 times as in the exercise above. Aim for just a bit more flexibility with each repetition.
Your physical therapist will also stretch your leg to help regain your knee's range of motion. This is a required part of therapy, and can be quite painful, but it is absolutely necessary to a proper recovery. Your therapist is trained to know exactly how far to take you, and will not hurt you, although it might feel like it at the time.
Use weight machines like a leg press, leg curls and other exercises under the supervision of your physical therapist to break down the scar tissue in the joint and increase your range of motion. Once you have completed physiotherapy, you should be able to fully straighten your leg, or at least come as close as possible.
Always have physiotherapy after this surgery. You cannot make a proper recovery without it.
Never push your knee past the point of sharp pain. When you are doing these exercises, expect some discomfort, but if sharp, shooting pain occurs, stop what you are doing immediately.