How could I loosen the tendons and allow the dip and pip joint to bend?

Exercise & Rehab. I am assuming your post surgery or injury. Once cleared by your doctor to do so gentle range of motion exercises with the fingers and hand will help re-establish full movement. Exercises like squeezing a raquet ball or working theraputty (or silly putty if your cheap like me) will help. If your not improving physical therapy, hand therapy or occupational therapy may help. Ask your doc about them.
It depends. Once a finger joint becomes stiff, it is very difficult to get it moving again. The longer its been stiff, the more difficult it is to regain loss of motion. Therapy is the main stay of treatment. This involves manual stretching as well as use of joint-jack tools to flex and extend the joint. Its not unusual to require surgery adhesions to loosen or release adhesions, scar, and tight ligaments.