I generally agree that Oswald probably wasn't thinking that far ahead. He had a demonstrated history of doing stupid things without regard to the consequences even with lots of planning. He'd planned his defection to the USSR for years, and his attempt on Walker for at least several months. He even delayed it to a night when a nearby church would be having services so he could escape into the crowd.
Although he anticipated being caught or killed (hence his note to Marina) his escape plan actually worked. Witnesses cited people getting into cars and driving off after the shooting when Oswald was actually on foot and took the bus. The Walker shooting remained unsolved until after the JFK assassination when Marina finally revealed it.
So when Oswald heard that JFK would ride by his place of work in just a few days, he had very little time for planning. Undoubtedly he felt that he just couldn't pass up the opportunity of a lifetime even if he were quickly caught or killed. And if something had gone wrong, say the limousine had the bubble-top or he couldn't set up an assassins' nest and remain hidden until 12:30, he could always call it all off. He could have quietly carried his rifle back home in the bag and no one would ever have known.
Still, a lot of conspiracists correctly point out that every other presidential assassin (and would-be assassin) readily confessed his role immediately after the act, and they do raise the interesting question of why Oswald was the sole exception. They claim this was because he was truly innocent, which is of course just utterly absurd to anyone who knows even a sprinkling of the real facts. For one thing, the other attempts had all used pistols at close range with a crowd of witnesses. Ruby might as well have denied shooting Oswald. JFK is the only president assassinated by a hidden sniper, although there were still quite a few good witnesses to the actual shooting.
Oswald made many obvious attempts, both before and after, to establish alibis and to escape. He bought his guns under an assumed name. He went out of his way to lamely pretend to one of his co-workers several hours before the assassination that he hadn't been aware of the upcoming motorcade that everyone had been buzzing about for days. When he left the Depository about 3 minutes after the shooting, he walked east on Elm Street and got on a bus that would take him right back through Dealy Plaza. After he took the cab to Oak Cliff, he had the cabbie drop him off several blocks past his roominghouse so he could see if the police were already there and to keep the cabbie from knowing where he actually went.
And the biggie, of course, is murdering Officer Tippit. Most of the conspiracy nuts just ignore it because it simply can't be explained as anything but a desperate attempt to escape arrest for a very serious crime. We'll never know what they said to each other, but Tippit almost certainly stopped him because he matched Brennan's description of the assassin that had been broadcast on the radio several times. It's possible that Tippit noticed Oswald's gun, but it seems unlikely given the nonchalant way he was seen to get out of his car. Oswald was also concealing it in his jacket. There's some question about whether Tippit was drawing his own gun when Oswald shot him; it was out of its holster when a witness grabbed it to play vigilante but it could have been knocked out when he fell.
We know that Oswald had an extremely high opinion of himself; he may have actually thought he could fool his interrogators. Certainly many other suspects have thought so only to find out otherwise at trial. Maybe Oswald's confidence was bolstered further by having gotten away with his attempt on Walker. Only once did he became flustered during his twelve hours of interrogation, when he was confronted with the backyard photos of him posing with his guns.
Oswald may have been delusional in thinking he could fool trained and experienced investigators, but he has succeeded beyond his wildest dreams in fooling the public. Had he simply confessed, the entire JFK conspiracy industry never would have existed. I think it's an example of the "big lie" principle in action. Most people don't tell huge lies over and over, so when they see Oswald hotly maintaining his innocence against a mountain of incriminating evidence, they begin to wonder if that mountain really exists.
Hey, it worked for OJ Simpson.