I know this may be difficult to answer because he was killed soon after the assassination, but what is the best guess? Was he a right-winger who hated JFK? A Soviet sympathizer who was angry that JFK invaded Cuba? Was he just someone seeking attention?
No one can say with absolute certainty since he was murdered by Jack Ruby while being transferred.
This article tries to determine his psychological profile. It says that he was likely emotionally distant due to his childhood and was prone to aggressive, impulsive outbursts. He was almost reported for domestic abuse, something that was underreported at the time, on multiple occasions. Oswald also seemed disconnected after the assassination. These are things you might find familiar after reading about current mass shootings.
Politically it's known that Oswald attempted to defect to USSR. He was sent back to the US though. It's likely that Oswald thought himself a revolutionary. There are pictures of him holding up a fist, something that radicals had been doing since the 1930's, and it could be a sign that Oswald saw himself as some kind of leftist hero.
So it could very well be that he just simply had delusions of grandeur brought on by a fatherless childhood along with a domineering mother who harmed his ability to interact with others socially.
Oswald was a very troubled guy. So troubled, that his teachers in New York when he went to high school wanted to send him for full time care at an institution for an indefinite period. (He was from the south but moved to New York City briefly. When his mother heard about interest in institutionalizing him, she packed up and went back to Louisiana with him, where they didn't have the social services to care about that sort of thing). Oswald was very angry, always feeling like he was being wronged, that his true genius wasn't being appreciated. He dreamed of doing something that would get him attention, at the same time as he wished to strike out at those who he saw as holding him back. He also never belonged anywhere, and kept joining causes to try to excel and to fit in, but it never worked.
He joined the military, but was poorly thought of and wasn't a good soldier. He started pursuing an interest in communism--a strange hobby for a US soldier during the cold war. But it was a way for him to find a different group to fit in with, since he so obviously was failing at being a good American soldier. He then attempted to defect to the Soviet Union--it was a way to show how important he was. He created this whole fantasy where his failures in the US army were due to how awful everyone else was. So now he was going to go to the Soviet Union, where he REALLY belonged and would fit in, AND he would be this great hero, with all this great information about the US army, to tell to the Soviets. Well, the Soviets rejected him. He was low level, not knowing anything they needed to know, he seemed unhinged, and why should they bother. So he tried to commit suicide. At that point, for whatever reason, they accepted his request to defect. But it wasn't what he'd hoped. They had no interest in what he knew, since they could tell what a nothing he was. He was given a low-level, boring factory job in an obscure place distant from anywhere interesting. It infuriated him because didn't they know how amazing he was? How dare they treat him this way?!! So he decided to defect back to the US (with new wife Marina in tow). He was just manipulative enough, just useless enough to either side, that the US took him back. But his return was awful, too. Again with the meaningless jobs that were beneath him. The Russian immigrant community lavished attention on Marina and shunned her shithead of a wife-beating, emotionally unstable husband. So he joined another group--Fair Play for Cuba. But meanwhile, he stewed at all the wrongs he saw as being committed against him. He sought to kill the powerful, successful men who were keeping him down. That would gain him fame and show how powerful and important he was. His name would live forever. He initially sought to kill General Edwin Walker in April 1963, but failed. It made sense--Walker was easily accessible to Oswald, who had no car. Walker embodied the conservative values he hated, plus the military he hated. But in the dark, by Walker's house, Oswald missed, and fled, thinking the sound could alert others. Meanwhile, he stewed in his own anger. But when he learned that JFK was coming to town, he decided to see if he could carry out this much more appealing assassination. As luck would have it, the parade route, published in the newspaper, went right by the place where he'd been working for several months (since long before any visit to Dallas was in the works for JFK, and certainly before any parade route was known).
There is an alternative hypothesis put forward by John Reston which claims that Oswald was actually aiming for John Connally.
Connally had been Secretary of the Navy, and Oswald had directly petitioned Connally to reverse his dishonorable discharge from the marines.
I'm not sure how we would go about testing this. It seems unlikely to me. Certainly there would be better access to the governor at times other than during a presidential visit, unless maybe he saw the combined target of two navy guys irresistible.
Imagine the hero he would have become if he shot Nikita Khrushchev.
Or what would have happened if Ussr taken credit?