"Thou" or "You"? This is the problem!
Solution 1:
There are two important distinctions.
The first is that thou (and thy, thine, thyself) is second-person singular. Ye is second-person plural. You is second-person of either singular and plural (originally only a case of plural).
As such, you can use thou only of one person. Ye would generally be used for either the plural, but due to the "T-V distinction" (named for the Latin tu and vos) ye would also be used as a formal form of the singular second person, with thou generally only for the either social inferiors or intimates, and it being impolite or downright insulting to use it for a superior or someone of equal social rank with whom you weren't close:
I thou thee thou traitor! - Sir Edward Coke to Sir Walter Raleigh, as a deliberate insult.
Don't thou those as thou thee. - Yorkshire proverb, advising young people in particular against being overly familiar with their betters.
An interesting exception though, is that thou is used of deities, most particularly (given the history of the English) of the Christian god, though also of others:
After this manner therefore pray ye: Our Father which art in heaven, Hallowed be thy name. Matthew 6:9 (KJV)
The second important distinction, is that we don't use thou any more. By the early 20th Century it was restricted to a few dialects in everyday use (one can find it in the Nottinghamshire dialect used in D. H. Lawrence's novels, but at that point the use would have marked the dialogue as regional), and now it's pretty much dead just about everywhere, bar a few older speakers in some parts and some small communities with a particular religious focus for reasons made obvious in what follows. Edit: Including Quakers, but only among themselves, as when they revived it in the 1600s but ignored the T-V distinction because they don't believe in distinction of social rank, people often reacted violently.
The main remaining use is in religious contexts, because people are often conservative about their scripture and liturgy, and having learnt their Pater Noster using thy they resisted changing to you. Even in religious use, revisions of bibles and prayer-books are making it less common.
Non-Christian religious use often leans toward it, whether in translation or creation:
Immortal Aphrodite of the broidered throne, daughter of Zeus, weaver of wiles, I pray thee break not my spirit with anguish and distress, O Queen. - Wharton's translation of Sappho's "Hymn to Aphrodite".
And thou who thinkest to seek Me, know thy seeking and yearning shall avail thee not unless thou knowest the mystery; that if that which thou seekest thou findest not within thee, then thou wilt never find it without thee. - "Charge of the Goddess", Doreen Valiente's revision.
Even here though, contemporary use is moving away from thou, and there are versions of all three religious texts I quoted above using you.
Can one use "thou" instead of "you" everywhere?
Due to the above, one uses thou pretty much nowhere in contemporary English.
In poetic use, then it must be singular, and intimate, and really requires a deeper knowledge than the above to use well; as per any bending of the rules, one needs to know them particularly well.
If you are using it in historical fiction, you'll need to research the etiquette rules in effect at the time, as they changed a bit over the period concerned.
Incidentally, the converse form ye as the plural and formal singular form still exists in some dialects (it's found in parts of Ireland, for example), but generally only as a plural form, not with any nuance of formal address.