This anime is indeed a unique one. I don't really like a long explanations when things are simple so I will try to make this really quick. Please note that this is just my version of explanation that I am now sending to the Wired ^^.
Alright, the first 8 episodes were nothing more than "Eh...WHAAAAT?". In fact I really thought about dropping this anime after the first episode but somehow I managed to keep it up and I don't regret that!
As I said, at first you know nothing. But somewhere around the episode 9 it is starting to be more clear. So as I understand it, Lain was an experimental human created by Eiri Masami, the founder of so called Protocol 7. It was not really explained how Lain came into this world but the probably set up the family and so on to make her feel like a human which she was in the end.
Protocol 7 was implemented as a communication protocol on the Wired (Internet) that had one special thing in it. It somehow managed to connect the human mind to the wired. Masami himself became a being living only in the Wired after he killed his real world body. He called himself the god of the Wired. Lain should have been his ultimate tool to finally completely connect the real world and the world of Wired. He even called Lain a software. In the end however, Lain realizes her own ego and refuses to act as a tool of Masami.
Lain became a human being even though she was designed as a program. It was probably the effect of her body that was natural after all (yea maybe artificially created but still human). It would never happen without Arisu though, who became Lain's best friend and showed to Lain that the world of Wired is not an upper level of the reality, that reality is right here and right now. During that moment Lain realized that humans are more than just a machines as Masami stated and she refused Masami and his visions. She has chosen a human love instead of machine's "perfection". Masami couldn't understand that since he gave up on his humanity and threw away his body. Lain even foreshadowed that maybe there is a real God in this world, not like the fake one Masami wanted to be on the Wired.
Alright but why did all the things happen in reality? Many times in the anime it was mentioned that the real world is just a projection of human mind. That what is not remembered by anyone never really happened. (Remember that famous philosophical question: "If a tree falls in a forest and no one is around to hear it, does it make a sound?") It probably deals with some theories of metaphysics that human mind is the source of everything in this world. Well think about it, is your world the same one that your friends perceive?
Anyway remember the KIDS experiment that Lain talked about with that old dying man? It was about collecting psychic power from children who died after that. I think that Protocol 7 used a similar concept to use the psi energy of people connected to it to make it possible for Wired to manifest in the real world. In the end Masami himself creates a new physical body that even Arisu who is not connected can see.
So in the end Lain, after realizing the truth refuses Masami's vision of the new world and performs total reset of everything that happened. She is even able to revive dead back to life with the psi power accumulated in the Wired. She also removes every memory of her from the world so that she cannot act as a God as Masami did and to make sure nobody will do it again. Some people say it's similar to the Christian concept of Jesus sacrificing himself for us. Yea she suffered cause she felt lonely after all. We can see that she sometimes comes to the real world to visit Arisu even thought Arisu have no idea who Lain is.
But what's interesting is that Lain is not God! Even the whole system with Protocol 7 is not perfect. Arisu have some blurred memories of Lain and not just her. It looks like her father, Masami and everyone else has some strange feelings that they forgot something that happened.
And Lain meeting her father at the table? It might sound weird but I think Lain died after deleting herself (even though she is somehow able to go back) and met God himself...