Oswald was a malcontent who blamed others for his marginalized life. He thought he was smarter than others who he viewed as sheep accepting their pathetic roles in life. That created resentment and a desire to show them who he was. He turned to Marxism for attention as a counterpoint to the mainstream American political establishment and to stick it to those who had ignored him. The assassination was a giant middle finger to those he held in contempt. His own personal resentment fueled an anti-hero perspective of himself in which he could be someone important. That much worked. What he didn't bargain on was someone else with a similar mentality who would gun him down.