I don't think Oswald wanted to be famous, as in known by everyone, but wanted to 'be someone' in his own head. I think he was a frustrated person who thought, if only he was given the chance, he could be someone and make a difference. He had fantasies of being a political warrior, striking a blow for world communism and in particular to support his hero, Fidel Castro, and for Cuba who he felt Kennedy was threatening. When he found out that the Motorcade was passing by his place of work then he took this as his moment to fulfill his fantasy. I don't think he fully thought it through, nor had he planned it in detail, so his action aren't logical but instinctive, including his actions after the event. I think he wanted to get away with it but I think he soon realised he couldn't - maybe from the moment he was confronted by Marion Baker. Once arrested he would ave tried, in my view, to continue to get away with it, denying it as he did and would have loved it to go to trial where he could have put across his political views to a world wide audience.
This is of course speculation on my part and contains lots of 'I thinks' but just adding my thoughts - I don't claim them as facts.