For example, if I'm in Z5, $-2$ is equivalent to $3$ which is equivalent to $8$. Also, the value of $x$ in the equation $4x = 2$ is $3$.
Note how any integer can be written as an integer that is within $\Bbb Z_5$ (ex. $-2$ and $8$ can both be written as $3$). This is how I solve arithmetic problems within certain $\Bbb Z_n$s: I find the answer normally, and then convert that answer to something that lies within the $\Bbb Z_n$ I'm working in.
For example, normally, $5 + 3 = 8$. But in $\Bbb Z_5$, $5 + 3 = 3$. I can solve this successfully using my method: first I find the answer normally (and get $8$), then I convert that answer to its $\Bbb Z_5$ form and get the answer I want (which is $3$).
The only time where I can't do this is when the answer is a decimal. Take the above equation for example. Normally, $4x = 2$ would tell you that $x = \frac 1 2$. But $\frac 1 2$ is actually already within $\Bbb Z_5$, but it is not equivalent to $3$, so my method did not give me the right answer in this scenario.
Is there some kind of flaw in my thinking that results in my method not working with decimals? What would the value of $\frac 1 2$ actually be over $\Bbb Z_5$? Do decimals not exist at all over any $\Bbb Z_n$?
Any help is greatly appreciated!
The problem is that when you say you're doing the original calculation "in $\mathbb{Z}$", you're not - $\mathbb{Z}$ has only integers, no fractions, and you can only divide two elements if the result is an integer. In $\mathbb{Z}$, $\frac{1}{2}$ doesn't exist. You've secretly swapped to $\mathbb{Q}$, which is why you're having trouble moving to $\mathbb{Z}_n$.
If you're doing division in modulo arithmetic, what you instead normally do is look for a multiplicative inverse of the thing you're trying to divide by - for a given $a$, you're looking for a number $b$ such that $ab = 1$, because even in $\mathbb{Z}_n$ you're allowed to do things like:
$\begin{eqnarray}ax & = & m \\ (ba)x & = & bm \\ 1x & = & bm \\ \therefore x & = & bm\end{eqnarray}$
The only thing you have to be careful of is that for a general $n$, some numbers may have multiple inverses, so you may have multiple solutions for your equation. There are some rules about which ones have unique inverses for every element, which you may learn at some point. That said, if you are working in a $\mathbb{Z}_n$ with unique inverses, you can kind of go back to writing $\frac{1}{2}$ (or at least $2^{-1}$) and have it mean almost what you think it means. It's no longer a value between 0 and 1, but it is a thing you can multiply 2 by to get 1.