People gave been drawing comparisons between the two for over 20 years. It's been said that there are only 7 basic plots, some even go so far as to argue that there are only 4, or possibly even 2, so it's not as though it's all that difficult to find two stories that bear some resemblance to one another.
The concept of "the chosen one" is quite popular in fiction and always has been. There are examples dating back to some of the most ancient stories that we have available to us, so that's not particularly noteworthy.
Main characters are often orphaned as infants. It adds to the sense of detachment, alienation and isolation that the author is looking to capture, and it helps to set the stage for the character's journey to discover his or her real place in the world. Not to mention that it enables the character to form bonds with other characters because there's no loving family to fill that role. A very widespread narrative device.
Being raised by an aunt or uncle is simply a matter of convenience. What would happen to most children if they were orphaned? If they had living family members, they'd likely be placed with them rather than placed into a state run facility. In most instances, grandparents are too old to look after a baby, so it would make sense for the child to be sent to live with an aunt and/or uncle. Again, these aren't especially remarkable coincidences.
Harry Potter knew what he was about before becoming a teenager. Perhaps he didn't know just how special he was, but he definitely had an idea. And to leave the big reveal about the hero's powers or prowess until he or she is a teenager makes sense. Young children don't possess the bare minimum amount of life experience required to attain any degree of wisdom, but teenagers are one small leap away from becoming adults. And adults are expected to make their own decisions and to choose their own path. It also enables an author to balance between catering to younger kids, who likely look up to teenagers, and to adults as well, who have been teenagers themselves and can thus relate. Kids make for boring heroes and main characters because they lack autonomy and they need to be coddled too much to make a plot built around them interesting.
To be fair, both Harry Potter and Luke Skywalker had more than 2 friends.
In the absence of a father figure, someone needs to fill that role. If we're expected to experience the development of the character over time, we need to see the source from which the character derives his or her sense of morality and purpose. If you can think of a better way to do that than to give the person a mentor, your story might be considered to be less derivative. Unfortunately, because we learn the things we know from older, wiser people, inserting a sage and moral, honorable and witty teacher into the mix sure does work.
Both stories feature a number of villains, and if you're referring to Darth Vader as being the primary antagonist in 'Star Wars', remember that he is but a servant of the Emperor. That's who most viewers would classify as the ultimate villain in 'Star Wars.'
If the hero never had to take what he or she had learnt and put it into practice without the guidance of the teacher, how would we ever be able to see whether or not the training was effective? How would we ever know whether or not the person really had what it takes to deliver the goods? It wouldn't make much sense to craft a hero that is never afforded the opportunity to shine outside of the shadow of his or her mentor. The teacher has to be removed from the equation at some point. Why not do it with a bit of dramatic effect?
I think you might have lost the plot on this one. I won't pretend to be a "Harry Potter" scholar of the first order, but from my experience with the series, the ending is definitive. And although it's been a few years, I'm fairly certain that I can recall the major events in 'Star Wars", and both Darth Vader and the Emperor are dead at the end of the story. They have obviously conjured up a new villain for the sequels, but nobody classifies those as canon anyway, they're a blatant cash grab and total and complete irredeemable rubbish through and through.