Reinforcement learning is learning by trying things.
There is no dataset of correct answers waiting for you.
An agent acts, the world responds, and a reward says how that went.
The reward can arrive long after the action that caused it.
A chess move that loses the game may only look bad twenty moves later.
Working out which action deserves the blame is the hard part.
The agent has to balance two urges at the same time.
Repeat what already works, or try something new that might work better.
Too much of the first and it settles for mediocre forever.
Too much of the second and it never gets good at anything.
It usually needs an enormous number of attempts to learn anything at all.
That is fine in a simulator and impossible on real machinery.
Whatever you reward is what you get, exactly and literally.
Reward the score and it may find a bug that farms points forever.
Writing the reward is where most of the real difficulty lives.