Knight endings can become very concrete and elaborate, but here we will only discuss a couple of simple ideas. These will be useful if you ever study knight endings in more depth.
We begin with the knight's ability to create a "barrier," which the attacking king must then take a long route to get around.
In this position the white king cannot move to d4 or d6 because these moves would each allow Nb5+ winning the pawn. White will therefore have to take a lengthy path such as Ke5-f6-e7 or Ke5-e4-d3-c4 etc. Black then has time to advance his own king, place his knight on a8 and trap the white king on a8 creating stalemate.

In the following position, Black can permanently trap White's king and save the game. However, his king must choose between two squares and only one choice works. The key is to realize that a knight cannot lose time; it will always take an even number of moves for a knight to leave and return to the same square. Black therefore should arrange things so that the approaching knight will always be placing Black's king in check, but never driving him off of f7/f8. A simple rule is to occupy the square which is the same color as the square the knight is currently on. Here the knight occupies a dark square (b2) so the king should move to a dark square as well (f8).
Another important idea is the defense of a pawn from behind by a knight. The knight is safe because the black king cannot capture without leaving the square of the pawn. This gives the white king time to get over and help.
Finally let's look at en example of the difficulty that a knight can have dealing with an advanced, passed pawn.