Typically in a cash game player two would win the pot. But please note that in a tournament situation player 2 would have a dead hand because it is against the rules not to bet the nuts in last position on the river. (Note I edited this post, and it seems the OP was trying to convey that player 3 was all in but I am not 100% sure).
The tournament rule in this case is designed to prevent soft play and collusion between players that definitely could unfairly alter the outcome of the tournament. In a cash game this kind of soft play is arguably not so serious of an infraction as it is in a tournament.
Most of the time this kind of situation in a cash game is innocent. The player gets so excited that he forgets he can make more money with a bet. Or the player just wants to give a friend a break.
Typically in a poker room there is a rule about showing hole cards before action is complete, and a floor person could technically kill player 2's hand. However since player two gained no advantage showing his hand, nor in this case effect any of the action (but his own), a floor person would generally not rule this a dead hand. The floor person might issue a little warning to the player to at least be careful about this kind of thing. If it seemed that player 2 was being kind to his buddy, the warning should be stronger.
If player 2 has a history of doing this often, had previous warnings about showing his cards before action was complete, his hand can be killed under most house rules, and maybe this is the time to let player 2 own his own actions, and kill the hand and consider barring the player from further play at your game. Even though the offense is minor, if a player does this all the time it does become very disruptive to a game. And the player should be dealt with in a manner that insures your game is protected and fair to all the players.
As to your question about what happens to the pot if player 2's hand is killed, player one would get the pot since player 1 now has the best hand of the two remaining hands.