Vim keeps track of an "undo stack", a linear history of all the changes you've made. Adding something in insert mode adds 1 item to the undo stack. Using
ctrl-r traverses up and down the stack until you being inserting something else.
In command mode, press
u to undo the most recent change. Easy!
To redo the most recently undone command, press
Advanced users will find undo branches useful. Vim actually keeps track of every change you've ever made. Vim uses a tree structure that can be navigated using
later. Further reading in this guide on vim undo branches.