The snakes were set up on the plane by Eddie Kim to kill Sean Jones, a witness to a murder being escorted to LA for testimony by FBI Agent Flynn (Samuel L Jackson).
The snakes are let loose and extremely agitated by a pheromone that was sprayed on the leis (flower necklaces). The snakes go wild an kill many passengers on the plane, including Flynn's partner. Some snakes find their way into the cockpit and kill both pilots. Flynn manages to get in touch with a snake expert in LA who knows of only one person who would have access to such exotic snakes. Oddly enough, this guy happens to be the primary accomplice, who easily sacrifices all the antidotes for the surviving passengers.
Back on the plane, Flynn decides that the best way to get rid of the snakes is to blow them out through a hole in the plane, which he creates by shooting the windows. Almost all the snakes in the plane are blown out of the window, while the passengers remain safely seat belted. Though both pilots are dead, the rapper's bodyguard Troy (Kenan Thompson) claims to be able to pilot the plane, although his only experience is on a video game simulator. Regardless, the plane is landed safely, and the surviving passengers and flight attendants take a breath of fresh air, until the one remaining snake sinks his teeth into Sean's chest, just before Flynn shoots the snake twice, both bullets being caught in Sean's impenetrable bullet proof vest.
It is implied that Eddie Kim will be caught and prosecuted on multiple charges of murder, it seems without Sean's testimony.
To repay Flynn for protecting him, Sean takes Flynn on a surfing lesson.