Maybe the mob employed him to do the deed.They have been presented as possibly wanting JFK out of their hair.Then Ruby killed Oswald to make sure he didn't talk.
Actuaully I don't believe in any conspiracy plot...It's just that JFK's death was so truamatic for the USA and the world that they/we had to go looking for a conspiracy theory.Just like they did with Diana.