The most common relative pronoun is "que". It can be used to refer to both persons and things, in either the subject or the object position. "Que" is the Spanish equivalent of the English words who, whom, which, and that.
El hombre/ el libro que está ahí (person/thing, subject)
La señorita que conocí ... (person, object)
La carta que leiste ... (thing, object
QUIEN" is used only to refer to PEOPLE, and has a plural form "quienes". (no masculine/feminine.)
Mi tío, quien es profesor, viene a visitarme hoy día.
When the relative pronoun refers to a person and is in the direct object position, either "que" or "a quien" may be used. The preposition "a" is used with "quien" but not with "que".
La señorita que/ a quien conocí anoche es la hermana de Raquel.
When the relative pronoun refers to a person and occurs after a preposition, "quien" must be used. After a preposition, "que" is only used to refer to things.
Los chicos, con quienes fuimos a la playa, son nuestros amigos.
El libro en que pienso es extenso, no es corto.
"EL QUE" is used to refer to both people and things. There are four forms (singular and plural, masculine and feminine): el que, la que, los que, las que.
Las mesas, las que son de plástico, son baratas.
Mi tío, el que es taxista, llegará pronto.
El cual, la cual, los cuales, las cuales can be used instead.
These are NOT COMMONLY USED in everyday conversation, and are generally reserved for WRITTEN Spanish or FORMAL oratory.
When the relative pronoun refers to an abstract idea, use "lo que".
Lo que quieres no existe
"CUYO" (and its related forms) relates the OWNER to that which is owned (the English "whose"). There are four forms to accommodate singular and plural, masculine and feminine: cuyo, cuya, cuyos, cuyas.
La niña, cuyO PADRE/ cuyA MADRE/CuyOS HERMANOS/ cuyAS HERMANAS es/son profesor/es, es muy simpática.
Note that the adjective agrees in number and gender with the thing being owned, not with the owner.