I have read of two ways to solve this program with the Simplex algorithm. One worked and the other didn't.
The only difference is that, in the one that didn't work, I rewrote the function. I will point it out below. I rewrote it because I saw it in an example somewhere else.
Why does this procedure not work? The correct answer is $$(x,y) = (2,0)$$
But I am getting $$(x,y) = \left(\frac{1}{3},\frac{5}{3}\right)$$
$$\min z = y - x + 1$$
$$-2x+y \le 1\\ x - 2y \le 2\\ x+y \le 2\\$$
Add slack variables $s_1,s_2,s_3$:
$$-2x+y+s_1=1\\ x-2y+s_2=2\\ x+y+s_3=2$$
$\color{red}{\text{The function can be rewritten as}}$
$$x - y + z= 1$$
The matrix is
$$\begin{bmatrix} x & y & s_1 & s_2 & s_3 & z\\ -2 & 1 & 1 & 0 & 0 & 0 & 1\\ 1 & -2 & 0 & 1 & 0 & 0 & 2\\ 1 & 1 & 0 & 0 & 1 & 0 & 2\\ 1 & -1 & 0 & 0 & 0 & 1 & 1 \end{bmatrix}$$
The pivot is [1,2]. Perform:
$$2r_1 + r_2 \ , \ -r_1+r_3 \ , \ r_1+r_4 $$
$$\begin{bmatrix} x & y & s_1 & s_2 & s_3 & z\\ -2 & 1 & 1 & 0 & 0 & 0 & 1 \\ -3 & 0 & 2 & 1 & 0 & 0 & 4 \\ 3 & 0 & -1 & 0 & 1 & 0 & 1 \\ -1 & 0 & 1 & 0 & 0 & 1 & 2 \end{bmatrix}$$
Now the pivot is [3,1]. Perform:
$$\frac{1}{3}r_3 \ , \ 2r_3+r_1 \ , \ 3r_3+r_2 \ , \ r_3+r_4$$
$$\begin{bmatrix} x & y & s_1 & s_2 & s_3 & z\\ 0 & 1 & 1/3 & 0 & 2/3 & 0 & 5/3 \\ 0 & 0 & 1 & 1 & 1 & 0 & 5 \\ 1 & 0 & -1/3 & 0 & 1/3 & 0 & 1/3 \\ 0 & 0 & 2/3 & 0 & 1/3 & 1 & 7/3 \end{bmatrix}$$
We are finished. The optimal solution is
$$(x,y) = \left(\frac{1}{3},\frac{5}{3}\right)$$
I assume you missed out the additional constraints $x,y\ge0$.
Note that we are minimising $z$ here. Since $z=y-x+1$, we should be increasing $x$ or decreasing $y$ with each pivot. Your first pivot should hence be $[2,1]$ or $[3,1]$ to introduce $x$, rather than $[1,2]$ which introduces $y$. However this is not the main error as it is still possible to find the optimum if you pivot wrongly (it just takes longer). When you claim that we are finished, the last row of the last table actually reads $2/3\times s_1 + 1/3 \times s_3 + z = 7/3$, i.e. $z=7/3-2/3 \times s_1 - 1/3\times s_3\le 7/3$. Hence, what you have actually shown is that the maximum is at $(x,y)=(1/3,5/3)$, with value $7/3$ (which is true). To find the minimum, you want the coefficients in the last row to be negative instead.