Robert dies, but creates a cure for the infected people first. He wasn't the only man left alive, Anna and Ethan are also alive. Anna was told by God to go to Vermont, where there was a safe haven with other humans. The safe haven is there, and Anna delivers the cure.
Robert Neville's (Will Smith) dog, Sam, dies and is infected. After only one day of living without Sam, he tries to kill himself by driving his SUV through a mob of the infected. After slamming his car around a few times, killing a few of the infected people, he is saved by two other living people, Anna (Alice Braga), a young woman, and Ethan (Charlie Tahan), a child. Anna reveals that God had "told her" to come to New York, then travel to Maryland where there is a safe haven populated by un-infected people. However, they forget to cover their scent when they bring Robert home, and the next night, the infected attack.
After a cheesy explosion that sets off many planted bombs around the outside of his house, more of the infected attack. Robert and the other two run down to the basement, into a plexiglass containment room. Earlier in the movie, Robert had captured an infected woman and tested a vaccine on her. As they enter the room, they realise the vaccine worked, and the woman was returning to normal. Robert draws her blood, and hands it to Anna, telling her it contains the cure. He locks them in a small safe on the wall, then pulls out a grenade and pulls the pin. Just as the infected are about to break through the glass, Robert jumps through and sets off the grenade, killing him and the few infected in the room.
In Vermont, Anna and Ethan appear in front of the gates where there are a about a hundred or so humans there to greet them. She hands them the blood Robert took from the cured woman, and the movie ends.
Thanks Attorney at Lawl!