As long as the group contains at least one masculine animate word and one word referring to a person.
mężczyzna i jego pies – oni
kobieta i jej pies – oni (despite no man in the group)
kobieta i jej pierścionek– one
The actual gender of the group that is referred to with a plural noun doesn't matter:
dzieci – one (regardless of genders within the group, since dziecko is neuter)
osoby – one (ditto, since osoba is feminine)
psy – one (since dogs aren't persons)
prawnicy – oni (regardless of gender, although for an all-female group of lawyers you can use the word prawniczki – one)
Non-human sentient beings vary:
bogowie – oni (deities are considered persons)
anioły – one (angels for some reasons aren't)
centaury – one
When it comes to some fantasy sentient beings, their grammatical personhood often varies and depends on personal preferences, which is then reflected in the declension:
elfy –one (elfowie – oni is less common)
krasnoludy – one (krasnoludowie – oni is less common)
orkowie – oni (orki – one is way less common since orki is plural of orka and it would be confusing)
Remember the "As long as the group contains at least one masculine animate word and one word referring to a person" rule? In fact, it doesn't concern itself with grammatical personhood:
krasnolud i elf – oni
There are some corner cases with masculine words describing professions and referring to women, or different sequences of subjects or various pluralities and genders, but they are rare enough and even as a native speaker I'm not sure about the grammar regarding those. For example, I still don't know what is the grammatical gender of the phrase "kobieta i jej psy".
In the last lesson we had a sentence "konie są duże", and I thought that the ending of "duże" is "e" because "konie" is plural. In this case we have "oni" which is a plural personal pronoun, but the ending of the adjective is "y", not "e". Why so?
In short (very): A „to” B, both A and B must be nouns and in nominative case (nearly always), when we use „to” we don't use verb „być”. A + „być” + B is different as it is not limited only to nouns but we must remember to use correct case and correct conjugation of „być”
Here is good introduction written by Jellei:
You need to know the gender of the word that is described by the adjective.
"stary" is masculine. "stara" is feminine. "stare" is neuter. "starzy" is 'masculine personal plural'. "stare" is 'not masculine-personal plural'.
Here you have two options. You can either assume that there is at least one man among 'them' and say "Oni są starzy", or assume that 'they' are only women and say "One są stare".