AI merely does conditional prediction based on statistical probability.
What that means, in most simple terms,
AI predicts what comes next.
For example, when AI is trained on text, what it does is merely this:
It predicts what word likely comes next in given context.
For example, if AI is trained on a sentence such as
"Cat likes milk",
AI learns that word "milk" more likely comes after words "Cat likes".
AI starts with basically random pattern prediction which is mostly nonsense until trained.
During training, AI updates it's probability in patterns.
For example, when patterns are random, AI will give words such as:
Milk likes cat.
Because it's random.
But once it learns based on text, it changes probability so now "Cat" comes as first word, word which follows is "likes" most likely, and "milk" follows based on that.
AI simply predicts the next word.
How AI does reasoning?
Reasoning in AI is done in same way of predicting what comes next.
The reason why AI reasoning is far from great is because AI doesn't actually do reasoning. It does statistical probability it learned during training.
AI doesn't reason, it doesn't "think".
What it does is simply predict what comes next in given context.
For example, AI will successfully answer that 10 + 10 is 20. Not because AI did math or reasoning, but because once you ask it how much is 10 plus 10, AI predicts what comes next. Because it learned from training data that what comes next is calculation answer, that's what it does.
And proof that AI doesn't actually do reasoning is found in AI hallucinations, which happen because AI is predicting what comes next, but predicting incorrectly because context changed and isn't similar to its training data.
For example, if you ask chatgpt to play chess, it will fail miserably.
Because it doesn't do reasoning. It predicts.
Chatgpt isn't trained on chess games, so it fails miserably to predict next move in chess.
But take AI specialized in chess, AI trained on millions of chess games to predict next best move based on chess games it learned?
That AI beats any chess world champion, not because it thinks better. In fact, such AI loses more often once people use different moves from usual play in its training data.
The reason why such AI wins a lot is because predicting next best move in chess came from it's training data. And once AI has working knowledge on millions of games, the only way it can lose is if it plays a game that doesn't match it's training data.
Because such AI has simple instruction to "win a chess game", and it does so by predicting what is next move in chess which statistically later resulted in win in games.