When is it in spelling that the personal pronoun 'you' should be written with capital Y?
You is always capitalized at the start of a sentence.
You is often capitalized when referring to God.
The practice of capitalizing pronouns referring to God originated at a time when pronouns referring to kings were capitalized. This practice has continued in the case of God up to the present day, but not consistently. The New American Standard Bible, for example, capitalizes all pronouns referring to deity,¹ but other contemporary Bibles do not.² Chicago Manual style does not capitalize pronouns referring to deity.³
Elsewhere, you is normally not capitalized.
As far as I know, only at the beginning of a sentence. Elsewhere in a sentence, the Y is lower case, y.
You may come and go as you please.
He told me, "You may come and go as you please."
I told you that you could come and go as you please, didn't I?
He has no idea that I came and went as I pleased; you do, however.
Contracts sometimes capitalize You when referring to a signatory to the contract:
Any time you see a capitalized word in a contract, it indicates that for the purposes of the contract, that capitalized term has a specific definition. You can find that definition where the capitalized term first appears in the contract, usually in quotes.
However, outside of specialized contexts like law and theology, you don't generally capitalize you in modern English.