When going down the straight past the pits, you'll go up places if there are pitted cars that were ahead of you.

I can't offhand think of a reason why you'd drop position unless you're passed. I've never observed it myself. The game "cheats" by not driving cars out of your view using the AI. Instead it pulls lap times and positions off an internal table, which is why you'll see some ridiculous situations. But as long as you're driving steadily I don't see how that would change your position.

Premium

I have experienced this, and it is generally due to lag issues, people disappear, pass you and reappear ahead. It's frustrating, but at least it's not they are lagging and flashing about front of you or bouncing up and down making it impossible to commit to an overtake.

During an online race, the last lap, I managed to get ahead and into 1st on the final straight, thought I'd clinched the win being about a cars length ahead, but the results shown that I was 0.8s behind 1st. A little irritating. I guess this was lag.