These are two basic and fundamental positions of chess endgames. Knowledge of these positions are highly important. I first heard about them in Jeremy Silman's "The Reassess Your Chess Workbook".
The first position is called the Philidor position and it is always a draw.
After 1.d6 the pawn is too far advanced and Black can just keep delivering checks from the bottom rank as white can no longer hide behind the pawn because of Black's King. The game is drawn. ---------- The next position is called the Lucena Position and it is a win for White. White wins through the method of "Building a bridge" which is simply bringing the King and Rook together so that the White King can be saved from perpetual checks by using his rook to block the check.
The second move Rf4 looks strange. But, it is the winning move because when white's King comes to d5 he can block the check from black's rook by Rd4 and white wins. Also note that 1... Ke6 fails to 2.Ke8. Thanks for reading and I encourage you to buy a copy Jeremy Silman's "The Reassess your Chess Workbook". It is probably the best chess book ever written. Seriously.