Around two decades after Yoda's defeat at the hands of Palpatine, a grown-up Luke Skywalker goes to Dagobah in search of a great warrior, the Jedi who'd taught his own mentor, Obi-Wan Kenobi (Alec Guinness). He finds Yoda, who doesn't appear to be much more than a senile hermit. But soon, Luke finds out that Yoda used to be the stuff of legend — powerful and wise, revered and feared. Plus, he could be pretty dang cryptic when he wants to be, but ultimately, he proves an excellent teacher for Luke, mentoring the young Jedi in the ways of the Force.
However, their relationship has its ups and downs. During his training, Luke ignores Yoda's advice and tries to confront Vader (David Prowse and James Earl Jones) when he senses his friends are in danger. He doesn't return to Dagobah until a year later, when he finds Yoda ill and dying. With Yoda gone, Luke becomes the very last of the Jedi, so Yoda asks him to pass on what he knows to others and become a mentor as Yoda had been for centuries. With his final breath, Yoda also drops the bomb that there is another Skywalker.
Upon his death, Yoda becomes one with the Force. But he isn't gone, thanks to his training to maintain his identity after death. Yoda appears again, many years later, when Luke is at his lowest during his own exile in "Star Wars: Episode VIII — The Last Jedi," and he uses his wisdom to help restore Luke Skywalker's faith in the Force.