In the flashback, Neville's daughter gives him Sam saying the puppy will protect him. It gave Dr. Neville a friend in his isolation, and indeed Sam saved him though at the cost of her own life.
The film's alternate ending. The reunion between the Alpha male Darkseeker and the female is almost indescribably tender, and very powerful.
Also in the alternate ending, Neville going with Anna and Ethan to the survivor's community. Three years of desperation and loneliness and bad deeds with good intentions, and Neville can finally be with people again.
The interactions between Neville and Sam, Sam is the only one keeping Neville anchored to reality and behaves like a puppy which is shown when she was refusing to eat her vegetables. When Neville tells her that they will stay until she eats them, the movie jump cuts to Sam being washed. Because of these interactions, it's what makes Sam's fate all the more tragic and heartbreaking.
In a meta sense, Will Smith actually wanted to buy Abbey (the dog who played Sam) because he had grown so attached to her but her owners declined the offer.