How does an AI learn?
There is no strong evidence that a single mechanism of learning exists in the neural networks of the human brain.  The scientifically collected evidence does not support that simplistic conception.

Learning is an umbrella term under which many things reside.


Accumulation of rules triggered by corresponding sets of conditions
Pattern recognition, such as the recognition of the probable source of a knock or a saxophone note
Connection between intention, motor output, and sensory feedback, backed by pattern recognition, as with hand-eye coordination
Construction and refinement of internal models of subjective reality that can be called upon to make choices or determine quantities
Construction and refinement of external models of objective reality, such as Newton's recognition that Kepler's description of elliptical orbits, Aristotle's attraction of objects to the ground, and the constant rate of velocity increase in falling objects were manifestations of the same phenomenon, thus the simultaneous invention of the foundations of both calculus and physics
Dreams during which insights can be gained, often of a seemingly illogical nature, yet reportedly useful in life goal attainment
Sleep in between dreams where it is possibly that the day's queued observations are integrated with existing learned material or otherwise assimilated
Largely creative or intuitive, where models and rules are combined to create hypotheses to be tested through experimentation or through long periods of in situ observation (observation in natural environment)
Subconscious and related to archetypes


There are several approach to simulating these partially understood learning mechanisms in computers. It is also important to note that not all machine learning is a simulation of a mechanism of the human nervous system.  What arrangements of architectures, algorithms, parallelism, and interconnections optimally learn depend on many things.


The nature of the things to be learned (tennis, calculus, how to recognize a zip code in a mail sorter, someone's voice, someone's retina or fingerprint, how to identify social or story structure in a drama, self-improving real time trajectory prediction and antiaircraft aiming)
The mechanism of input and output (tabular, natural language, sound, visual, tactile, stepper motor signals)
The balance of the dimensions of the quality of intelligence to which the term optimal can be applied (accuracy, reliability, range of conditions for which learning is functional at all, relationship between complexity and speed of response capacity for complexity, depth of abstraction, wit in presentation of conclusions, listing of reference, auditability of thinking)
Hardware running the algorithms, their processes, and interconnecting them


How Learning Presumably Occurs

The current scientific theory (which is subject to change as more discovery occurs and paradigms shift) is that the human brain is programmed by the portions of DNA that define neural structures.  It is theorized that structural changes inside of and between neurons persist memories and establish pathways that lead to adaptations beyond instinctive neural activity and organism behavior, which is part of the DNA programming.

Organic or Digital Circuit Based Learning

For learning to occur in either a meat or silicon based system, there are a few requirements, the listing of which will give a general view into the answer to the question.


Way for the system to understand what is expected of it (real time acceptability/unacceptability/quality feedback, built in goal achievement detection, crisis detection, or multiple cases of conditions and expected results)
Way for the system to persist information needed to hold a representation of what had thus far been learned
Way for the system to acquire input or sense conditions
Way for the system to output results, execute decisions made, or impact conditions
Way to load algorithms into processes, interconnect them, and manage the overall system throughput
Hardware to support the above
Optionally, typical enterprise type features such as crash/disaster recovery, the ability to independently handle concurrent learning processes on a single system, or the ability to scale the system to handle larger problems or more concurrent learning processes


All of the above is dismissing entirely the possibility of concepts such as synchronicity, the metaphysical, or deity, none of which have been scientifically disproven.

Code

There are a few code bases that may help begin an investigation into learning using some of the most common and publicly available approaches.  Some of these have evolved to learn for specific problem sets.


https://github.com/mnielsen/neural-networks-and-deep-learning
https://github.com/kootenpv/neural_complete
https://github.com/rougier/neural-networks
https://github.com/jcjohnson/neural-style
https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
https://github.com/uncomplicate/bayadera
https://github.com/timnugent/naive-bayes
https://sourceforge.net/projects/cpp-fuzzy-logic/
https://www.codeproject.com/Articles/316668/Cplusplus-Fuzzy-Logic-API-plus-Simple-DSL
https://github.com/abudnik/tcalc
https://github.com/metagol/metagol
https://sourceforge.net/projects/clipsrules/
http://openrules.com/
https://www.drools.org/


Truly Learning About Learning

Rather than running example code, it may be best to commit to actual learning about learning.  Downloading, compiling, configuring and running some existing POC is not your proof of concept.  It may be your starting point, but until you change those POCs to perform some other task you've devised and for which you've located sufficiently realistic data, you haven't learned anything about learning yet.

This is an example of a self-constructed lab project that wades right into the center of learning about learning software.


Develop an object oriented model of a tic-tac-toe game
Develop classes to represent the possible moves available for two opponents
Add an object oriented model of HOW the next move could be decided based on some arbitrary logic that can be mutated or permuted
Create some mechanism to try various HOWs in actual play
Create an algorithm that processes as input win-loose statistics and the
corresponding HOWs that converges on the optimal HOW for winning


Representing the tic-tac-toe three by three grid and the possible moves that players can make may only require a few dozen lines of code, but the simulation of human learning of the game (or some other form of learning the game that humans might not actually do) is not simple.

Even for the limited problem set of tic-tac-toe games, to write a program that actually learns the always-win-if-winning-is-possible algorithm by actually learning tic-tac-toe by playing it is complex and raises questions about random versus educated guessing worth investigation and about which many articles and books may be found and studied.

Developing such a program that learn successful tic-tac-toe play without knowing how to win in advance may take some brilliant thinking and days of programming, testing, experimenting, and re-thinking.  However, that will reveal more than reading articles, posts, books, or library documentation.

Writing a program that would deduce how to play tic-tac-toe from the rules of the game represented as predicate logic is a longer term project but may be rewarding and quite educational.