"restare" is used when:
1) you stop in a location-> oggi resto a casa, in città restarono solo le donne. In these situations restare is synonymous to "rimanere" "trattenersi"
2)you remain in a certain state-> rimanere in piedi/seduto/sveglio
3)sth is left over, remains-> mi restano pochi soldi e molte speranze
and in more other expressions like-> restare vedovo/di sasso/ a bocca aperta
"stare" on the other hand you use in a lot of other situations like->stare fermo/sotto un albero
non stare mai senza far nulla
sto a casa, sto al primo piano (means to live at the first floor)
or when sth is located somewhere-> i vestiti stano nell'armadio/ in quel recipiente ci sta molta acqua
Anyway there are loads of other uses that you, for sure, will learn and understand once you have improved your italian. Hope to have made it a little clear to you