Getting your bird to accept you petting it is more about being in tune with your bird and learning to work with its personality than it is about training. A bird's comfort level with people can vary greatly, and some just like their personal space. If you have a bird that does not like to be touched, you will need to learn how to approach it in order to make it comfortable with contact.
If you have a cuddly bird that likes human contact, it probably won't take much effort at all to get your bird lowering its head to get you to scratch it. Some birds, such as parrots, budgies, and parakeets are more likely to allow touching than others. But even within bird species, there are different personalities.
You can do a little bit of training to get your bird more comfortable with the idea of petting. As with other forms of training, practice the behavior with short, frequent sessions and don't press on if your bird is cranky or grows tired. You can always try again another day.
Learn Your Bird's Cues
When training your bird to accept petting, the first step is to read the cues your bird is giving you.
Does your bird assume a stiff posture and stare at you when you approach it? Does it run away, try to push you away, or even try to bite you? These are clear signs that your bird is not comfortable with what is happening. Owners may find that reaching for the bird's head to pet it may be perceived as a threat, especially if you try to reach the back of the head. If you ignore the body language of a stressed bird, prepare for a potential bite from them.
On the other hand, a bird that likes being pet is relaxed and will often turn its head a bit to the side, or even bow its head down, for scratches and petting. Some will bow their heads down and even close their eyes, a sign of a happy bird that fully trusts that petting is not a threat.
Strategically Start Your Training Time
To begin your training, choose a quiet time when your bird is relaxed, after eating or just before its usual bedtime. Keep your hand in full view of your bird, and speak to it before petting it. Don't try to force it; if the bird resists, take a break.
Begin With the Beak
Try lightly touching and petting your bird's beak at first. Be careful not to poke its eyes, and be prepared for it to try to nip you (more of a threat from a larger bird, obviously). If your bird lets you touch its beak, try gradually moving your fingers to the skin on its face just behind the beak. Work your way around the side of your bird's head if it is comfortable with you petting its beak and face.
Move to the Body
If you can move the bird's body, work with the natural orientation of the feathers. Petting the feathers against the grain can be irritating for the bird. Pet in the direction the feathers naturally lay down, or gently scratch side to side between the feathers. Eventually, as your bird relaxes, you can work your way around to the back of its head and neck.
Problems and Proofing Behavior
If your bird is slow to take to petting, don't give up. Take small steps and continue to practice. Even just showing your hands in front of your bird is a beneficial step to continue to practice and will get the bird comfortable with your hands. While a good cuddle might be nice for you and your bird, it is a good idea to avoid excessive petting and to avoid petting the back and body of your bird. A mature bird may find petting in these areas stimulating which may result in a sexually frustrated bird and, in turn, may lead to behavior issues.
A common mistake for bird owners is that petting becomes the only way you interact with your bird. Birds need socialization in many other ways. Take part in tricks, games, exploring, toys, talking, or just being together. Your bird will benefit greatly from these interactions.
Ultimately, if your bird does not respond to your attempts to pet it, you may just have to accept that it's not a cuddly bird and be content with admiring it and caring for it from afar (or, from a short distance). Persisting in petting a bird that just doesn't like contact is going to erode your bird's trust in other areas and may cause harm to the relationship.