It ended with all of them gathered in the church that had the equipment in it to find the island. Jack killed Locke. Jack died. Then he met his father in the church (who was dead) and Dr. Shepard explained that everyone was dead.
The final scene was the doors in the church opening and it being flooded with light. Corny ending.
Well everything that happened did happen (it wasn't a dream or anything). At the end though, it was like heaven, where everyone could talk about how they died and what happened, because those are the only people that Jack had in his life. (A.K.A. the island gave him someone/something to care about)