It's just a way for a snake to say "Leave me alone!" Perfectly normal. Often seen when captive snakes are eating, or when wild snakes are disturbed. It is not at all predictive of a bite.
Many, maybe most, snakes of all species rattle. Rattlesnakes just took it to a whole 'nother level when they evolved and moved away from swamps and out to the prairies to prey on prairie dogs, rabbits, and other small mammals that lived there. Bison herds kept the grass mowed down, so it was the perfect environment for small grass-eating mammals. Rattlesnakes followed the prey out to the prairies. Rattlesnakes, being heavy bodied and relatively slow ambush predators, needed a way to warn large hooved animals to keep away, and evolved the hollow scales on their tail tips which greatly amplified the tail rattling noise. The rattlesnake, rattling, is saying, hey, I'm here, don't step on me!! Snakes without rattles do just fine on their own, though, when rattling their tail against leaves (or plastic bins)!