Did Obi-wan find it important to have Luke see it? Isn't that setting him up to fall to the Dark Side?
Obi-Wan knew what was going to happen even before the fight with Vader. When R2 found the locations of the tractor beams, Luke wanted to go with him and Obi-Wan said, "Your destiny lies along a different path than mine." He knew, at the time, that he was going to be facing something where he might not survive. He probably even knew that there was no way he would get off the Death Star without facing Vader.
His goal was not for his own survival, but to allow Luke and Han (and Leia, if he was aware of her presence with them) to escape. As long as he was dueling with Vader, then Vader's focus was on him, not on the ship, the Princess, or anyone else. Obi-Wan may not have planned or choreographed the fight so well as to be right at the hanger, to distract the guards, just as Luke and his group needed to escape, but he was able to keep Vader distracted.
Once he turned and saw all the Stormtroopers, as well as Luke, Han, Leia, and Chewie heading toward the Falcon, he knew he had accomplished what he wanted. Vader had been distracted and Luke and his friends could now escape. But he had Vader in front of him and a large number of Stormtroopers surrounding him. Considering his age and lack of recent combat experience, the odds of escape for him were overwhelming. He knew he could still guide Luke as a Force-Ghost, so he was ready to die rather than to face capture and torture, where he might reveal information that could hurt Luke or the Rebels.
His goal, of aiding Luke's escape, was realized and he was surrounded. There was no need to continue the distraction, so, with his purpose fulfilled, he was ready to face death.
Disclaimer: This is pure speculation.
Even though the audience didn't know at the time, Obi-Wan knew that Vader was Luke's father, and was concerned that Luke could be influenced by the dark side of the force.
Obi-Wan wanted to solidify his influence over Luke, and ensure that Luke was allied with the Jedi and the Rebellion. He intentionally manipulated Luke emotionally by telling him that Vader killed his father (which wasn't true), and by making sure that Luke saw Vader kill Obi-Wan.
I think this is what Obi-Wan really meant when he told Vader "If you strike me down, I shall become more powerful than you can possibly imagine." By having Luke witness his death at the hands of Vader, he strengthened Luke's emotional attachments to Obi-Wan, the Jedi, and the Rebellion.
It doesn't make much sense before watching ESB and RotJ. But after watching the entire saga, that scene now makes perfect sense.
I've spent a lot of time reading my children some of the novelisations of the stories, and in those it says that before Vader strikes him, Obi-Wan becomes one with the force like Yoda in Return of the Jedi.
So the death seems very much for effect rather than it being a killing blow.
I only saw the movies for the first time several years ago, but it always seemed to me that Obi-Wan did it to get back at Anakin for his betrayal of turning to the Dark Side. It seemed to be something that he never got over and the act of setting that up so it looks like Darth Vader killed him makes it harder for any sort of positive relationship to be salvaged between the younger Skywalkers and Anakin.
I've read the other comments and Idk if they are just missing this idea or if it is not possible based on the extended media of the Star Wars universe, but What if Obi-Wan died on Tatooine between trilogies? As far as I know, it's not clear what Obi-Wan did on Tatooine for the 19 years that he was "keeping an eye on Luke", but I do know that Tatooine is a harsh landscape in the Outer Rim and must be unforgiving and dangerous to those that do not know its secrets.
Just thinking about how much Obi-Wan ages in 19 years if you think of the movies in chronological order, it is entirely possible that he died in his house on Tatooine and somehow figures out how to reduce the blue glow that would initially give him away.
Alec Guinness openly despised the role of Obi-Wan, referring to it as "fairy-tale rubbish" with "banal mumbo-jumbo dialogue, none of which makes the character even bearable". Sir Alec convinced Lucas to kill off the character, ostensibly to make him (Obi-Wan) stronger, but really so he (Sir Alec) could wrap up his part and get off the set, preferably permanently. It's not like he needed the money.
Lucas, being a moderately competent scriptwriter (keep him far, far away from any romantic plotline), decided to put Obi-Wan's death where it is. Falling off one of the non-OHSA-approved walkways that seem to be absolutely everywhere would have been rather anticlimactic, but a swordfight against the Dark Lord? Oh yeah.
And for the whiners who say this is an out-of-universe answer: Reality wrote the plot here. If Sir Alec was a Trekkie his character would not have been offed 2/3 through the film, and the rest of the story would have turned out rather differently. Maybe in that universe there is no Yoda, as the green guy basically takes over OW's role.
Well I have a different take on it - Obi-Wan possessed (or joined with) Luke's body.
If the other movies were never made, it could make a lot of sense.
I have a more prosaic answer: plot line. Killing off a beloved character made it a better story. Luke was in desperate need of further education, and arguably Obi-Wan would have better served his cause by teaching rather than dying. That, however, would have been a less emotionally effective plot point and also had the further benefit of simplifying the plot going further. In any case, his death did not enhance their changes of getting off the ship, since that was actively desired by Darth Vader in the first place.