While this is not a complete answer, the basic principle goes:
Where the outcome is unpredictable, current state + possible moves = outcome. so, for any given state (in the case of having a certain number/combination of cards, possibly in combination with others having a number of unknown cards, or certain cards having been seen since the last shuffle) of the game, there are a number of possible moves you can do (hit, stand). You would then try either one, and record if that gives you a good or a bad (or somewhere in between) outcome. Next time you see the same current state, you see which possible move gave you the best statistical outcome so far (with a % of randomness).
Where the out
If you have multiple moves, and you don't get an actual result until the end, you would keep a track of all (state+tried move) so far; once you get a result, you apply that to every step along the way.
Once this is done, you get it to play a huge number of games, and it should get better as it goes.
The trick, usually, is to work out what constitutes a "state". The more possible states there are, the more games have to be played before the AI gets good, and the larger your database will be. In blackjack, you might have a state of just the sum of the number of cards (which gives you 20 states), or it might include how many of those are aces (which gives you, I guess, maybe, around about 40 states); it might include how many cards other players have; it might include exactly which values you have in your hand but not the suit (if you have 4 aces, you know noone else has an ace), or might include (pointlessly for Blackjack) the order a suit of the cards.
In some cases, the "state" might be more abstract. For example, in the case of chess, there are many possible "states" to learn them all, and we have to abstract. I don't know what's usually used for this; perhaps what is attacking what and what is defending what, how many squares are covered by how many pieces, which pieces are defended by what, etc.; or
You might also want to consider what constitutes "good" and "bad" outcomes. You might assume that, for blackjack, a win is good, and a loss is bad, and that's all there is to it. However, there is something to be avoided more than losing: making an invalid move. In the example of blackjack, assuming your AI does not know the rules, splitting if you have any hand other than a pair, is something far worse than (possibly) losing. If you count this as a "loss", it would eventually get the hint and stop doing that.