A rattlesnake, like other pit vipers such as the cottonmouth and copperhead, has pits on the sides of its head which detect infrared radiation which is produced by potential warm-blooded prey. Normally, when dealing with a juicy rat or other mammal, the snake will strike, inject its venom, and then withdraw so that the animal can go through its death throes without biting or scratching the serpent. Once the victim has shuffled off this mortal coil, the reptile will leisurely ingest it.
Birds, however, are another problem. If the snake bites the bird and then releases it, the bird could easily fly an inconvenient distance far away before it dies. Therefore, if the snake has struck avian prey, it will hold onto it firmly for dear life (or more accurately, for dear death) until the bird is deceased and ready for swallowing.
The ability to distinguish between the best methods for swallowing mammals and birds is instinctive, not learned. Rattlesnakes raised from birth in captivity, on the first time they encounter a fowl, display the same savvy behavior as their companions in the wild.
Oh, and with respect to the attached image? Don't try this at home. It isn't very sanitary.