If I get 1 or 2 stars on a war attack and someone later gets more stars than I do, do I still earn those stars/do they still go to my rewards and stats?
Yes, you still earn those stars under your profile.
The person who attacked after you and gained more stars would also receive the full amount of war stars that they got on the attack. So if they 3-starred the base you attacked they would get 3 stars on their profile and you would still have your 1-2 stars counted on your profile.
As far as the clan war is concerned only the best attack is counted.
Do they go to your stats?
Individually, both you and the other attacker gets the respective stars of your attacks.
However, in clan stats, it's only counted once; the best attack counts.
Do they still go to my rewards?
It is determined by your individual result. If you stuffed up your attack, but someone else manages to win (get at least a star), you get the loss bonus, while the other person gets a win bonus.
Same happens vice versa (if you have a successful attack, but another person fails, the person who failed gets the loss bonus instead of a win bonus).
Obviously if you both lose/win, you both get the lose/win bonuses respectively.