You pick your rival with 7 races left in the season, and as long as you beat him, then you will be able to move to Ferrari next season. I was able to beat my rival in my first season and take his spot after switching teams mid-season, so I’m not sure what happens in regards to changing teams if you don’t manage to beat him.
All I will say is that Championship points don’t really count for beating your rival, unfortunately. In the final 7 races, you just have to beat him 4 out of those 7 times in the races in order to be offered their seat. Though, I was offered the seat just before Brazil, despite being tied at 3-3, but oh well :P