Training for flexibility should not hurt regardless of the type of stretching you are performing. There are a variety of stretching methods and techniques, but all of them should be done pain free.
Most people are familiar with static stretching, which involves holding a stretch over time for a particular muscle or muscle group. You should ease into the stretch until the first point of resistance. You will feel some mild tension, but hold the position for approximately 30 seconds. If you feel the muscle start to loosen up in the process then gradually move further into the stretch.
Conversely, moving into a pain-filled stretch can be very dangerous and result in injury to the muscle and connective tissue. Pain is actually a signal from your body to back off and relax the stretch. By moving too far into a stretch, the body will utilize a stretch reflex, which will contract or shorten the very muscles you are trying to lengthen. This reflex is really a form of protection against injury. Also, remember to breathe throughout the stretch because holding your breath can make your body tense up as well.
Just remember, stretching is very important for us all, but progress slowly through a pain-free range and you will see your flexibility improve.