I believe the first pattern is (with (0,0) at top left)
$$\Biggl\{\left\lfloor\frac{2x+3y-2}8\right\rfloor+\left\lfloor\frac{-3x-2y+3}8\right\rfloor \Biggr\} \mathop{\textrm{mod}}5.$$
And the last is (with (0,0) at top left)
$$\Biggl\{x+y+m(x-y)-\left\lfloor\frac x4\right\rfloor\Biggl\}\mathop{\textrm{mod}}5$$
where
$m(x)$ goes $0, +1, 0, -1$ depending on $x$ mod 4. There are lots of lookup-table-free ways to define $m$; for instance $m(x)=(x \mathop{\textrm{mod}}2)\cdot(-1)^{\lfloor x/2\rfloor}$.
The question has been updated to include a request to "explain your answer".
I don't have much explanation to offer for the first pattern. I just
thought I should try things of the form $\lfloor\textrm{linear}(x,y)\rfloor+\lfloor\textrm{linear}(x,y)\rfloor\pmod5$, with the coefficients of the two linear things matching up so as to give the pattern the right sort of symmetry; the periodicity of the pattern suggested that I probably wanted 8 or 16 in the denominators, a bit of experimentation showed (as should have been obvious from the outset) that the difference between the $x$ and $y$ coefficients shows up in how many "bands" there are from southwest to northeast, and then there were only a few cases to try to see whether they gave the right pattern. After finding something with the right pattern but an offset in $x$ and $y$, I replaced $x,y$ with $x-\delta,y-\epsilon$ where $\delta,\epsilon$ was the offset I needed to produce, and simplified. Done.
I can say a little more about the fourth.
First of all, the very obvious banding pattern suggested that inside my "... mod 5" I wanted a term $\lfloor x/4\rfloor$. The rest then needed to yield a nice simple periodic "snake" pattern. The snakes run southwest-to-northeast going right, right, up, up, right, right, up, up, right, right, etc. If we just took the contours of $x+y$ then we would have plain diagonal lines, which are actually rather similar to those snakes; we can turn diagonal lines into snakes by adding and subtracting 1s in a carefully selected set of places. If you add 1 all down a northwest-to-southeast diagonal line, you effectively push all the contours one unit diagonally inward; if you subtract 1, you effectively push them one unit diagonally outward. Staring at the pattern a bit one sees that what's needed is for half the NW-SE diagonals to stay as they are and the other half to alternate between being pushed in and being pushed out, which means we need to add that function $m(x,y)$ before reducing mod 5.