So I watched Memento for the second time, and I felt like I understood the story pretty well, however, some things don't make so much sense to me. As far as I know:
Leonard, the main character, did in fact see his wife being raped in the middle of the night by two criminals. He got hit in his skull and was injured, hence his condition.
Some time afterwards, Leonard and his wife were involved in a car accident. Since then, he could not remember anything for longer than 5-10 minutes. His wife wasn't hurt.Apparently, there was no car accident (see s427's answer & comments).
Since the injury all he could remember was things happened to him before the injury, like his name, his former work, etc.
Since his memory condition, he has managed to live by making puzzles and playing detective in order to find the "guy who murdered his wife". He can't remember he had already found this guy, who in fact raped (not murdered) his wife, and killed him. Teddy, a police officer, has helped and is helping Lenard with his puzzles in order to give his life meaning.
Leonard killed his own wife with the insulin shots - she died because of an insulin overdose (Sam Jenkins story).
Most of those details are being revealed at the end of the movie (the last scene, which is really the beginning of the sequence of events). Teddy, the police officer, tells him who he really is - Sam Jenkins. Now, this is what I don't quite understand:
Leonard tells everyone he was an insurance investigator, and he was the one who handled the Sam Jenkins case. If he is Sam Jenkins, then was he ever an insurance investigator? If he killed his wife with the insulin shots, doesn't it mean that he used to be a doctor? Did he make up the insurance agent story? Why, and how? (because it means he was looking at himself from the outside).
In the Sam Jenkins story Lenard says that he was in a hospital after he killed his wife. Was Leonard really in a hospital? When did this happen, and how did he recover?
How does Leonard know he has a memory condition? Sam Jenkins, as seen, wasn't aware of his condition, and if Sam is Lenard after the accident, how can he be aware of his condition? Even if someone told him about his condition, he wouldn't remember it. I know he had "Remember Sammy Jenkins" tattooed on his arm. This is how he remembers he has this condition?
Here is the final dialogue between Leonard and Teddy, in the final scene, where most of truth about Leonard is being revealed:
Leonard: He knew about Sammy, why would I tell him about Sammy?!
Teddy: You tell everybody about Sammy! Everybody who'll listen! "Remember Sammy Jankis?" "Remember Sammy Jankis?" Great story. Gets better every time you tell it. So you lie to yourself to be happy. There's nothing wrong with that. We all do it. Who cares if there's a few little details you'd rather not remember?
Leonard: What the fuck are you talking about?
Teddy: I don't know. Your wife surviving the assault. Her not believing your condition. The torment and pain and anguish tearing her up inside. The insulin.
Leonard: That's Sammy, not me. I told you about Sammy.
Teddy: Yeah, right. Like you tell yourself over and over again. Conditioning yourself to remember, learning through repetition. Sammy let his wife kill herself. Sammy ended up in an institution. Sammy was a con man. A faker.
Leonard: I never said that Sammy was faking.
Teddy: You exposed him for what he was. A fraud.
Leonard: I was wrong. That's the whole point. See, Sammy's wife came to me...
Teddy: Sammy didn't have a wife. It was your wife who had diabetes.
Leonard: My wife wasn't diabetic.
Teddy: You sure?
Leonard: She wasn't diabetic. You think I don't know my own wife? What the fuck is wrong with you?
Teddy: I guess I can only make you remember the things you want to be true. Like old Jimmy down there.
Leonard: He's not the right guy.
Teddy: He was to you. Come on, you got your revenge. Enjoy it while you still remember. What difference does it make whether he was your guy or not?
Leonard: It makes all the difference.
Teddy: Why? You're never gonna know.
Leonard: Yes, I will.
Teddy: No, you won't.
Leonard: Somehow I'll know.
Teddy: You won't remember!
Leonard: When it's done, I will know.
Teddy: I thought so, too, I was sure of it, but you didn't! That's right. The real John G. I helped you find him over a year ago. He's already dead.
Leonard: Don't lie to me any more.
Teddy: Look, Lenny...I was the cop assigned to your wife's case, I believed you. I thought you deserved a chance for revenge. I'm the one that helped you find the other guy in your bathroom that night. The guy that cracked your skull and fucked your wife. We found him, you killed him. But you didn't remember. So I helped you start looking again, looking for the guy you already killed.
Leonard: Oh, yeah? So who was he?
Teddy: Just some guy. Does it matter who? No reason, Lenny, no conspiracy, just bad fucking luck. Couple of junkies too strung out to realise your wife didn't live alone. But when you killed him I was so convinced that you'd remember. But it didn't stick. Like nothing ever sticks, like this won't stick. I took that picture. Just when you did it. Look how happy you are. I wanted to see that face again.
Leonard: Oh, gee, thanks(!)
Teddy: Fuck you. I gave you a reason to live and you were more than happy to help. You don't want the truth. You make up your own truth, like your police file. It was complete when I gave it to you. Who took out the twelve pages?
Leonard: You, probably.
Teddy: No, it wasn't me, see, it was you.
Leonard: Why would I do that?
Teddy: To create a puzzle you could never solve. Do you know how many towns...how many John Gs or James Gs? I mean, shit, Lenny, I'm a fucking John G.
Leonard: Your name's Teddy.
Teddy: My mother calls me Teddy. My name's John Edward Gammell. Cheer up. There's plenty of John Gs for us to find.