Here's why:
* Prepositional phrases start with a preposition (like "with", "on", "in", "at", etc.) and are followed by a noun or pronoun (the object of the preposition).
* "With" is the preposition.
* "its rattle" is the object of the preposition.
The phrase "with its rattle" modifies the verb "warns" and tells us how the rattlesnake warns those around.