There are a number of ways to do it.
One really important one is to learn what the stitches look like, so like if you're doing rib work, you don't always have to count to know what comes next. I think everyone preaches this, hahah!
Other ways I've used, are to either keep tabs of how many rows I've done (I did this when I was making a pair of gloves with a 4x1 rib, and cable row, so I would just make a one mark on my paper every row, and then a C for every row I make the cable).
For more complicated things, like a lace bracelet I did, I printed up the chart for the pattern, and would cross out each row in pencil as I did it (could do each stitch if you wanted too). When I had to repeat the pattern again, I would just erase the pencil and start over!
Also, stitch makers are useful to keep track of both stitches and rows. For example, you could knit a stitch marker in, knit how ever many rows your pattern calls for, and then place another stitch marker, this way you don't have to count your WHOLE piece of work.
You can also have them on the needles, to seperate pattern repeats. Like say every 10 stitches, you need to do a yarn over... you could have a stitch marker on the needles every ten rows to remind you of where you are in the row.
And after a while, the pattern will stick in your head (and never go away!!). I've still got '1, 2, 3, 4, 1, 1, 2, 3, 4, 1, et cetera' playing in my head from the wristwarmers I made 0_0.