You have probably fallen victim to didactic oversimplification.
Max lernt Deutsch, weil er in Berlin studieren möchte.
Max möchte in Berlin studieren, deshalb lernt er Deutsch.
Sometimes, pairs as the one above are used to put weil and deshalb in opposition. While the former introduces subordinate, verb-final clauses ("Nebensätze"), the latter occurs in independent main clauses ("Hauptsätze"); at least, that is what the examples suggest.
Hopefully, such expositions at least point out that, deshalb being an adverb, it can occur after the finite verb as well, just like any other adverb.
Ich lerne jetzt auch noch Spanisch.
Jetzt lerne ich auch noch Spanisch.
Therefore, the following is possible as well.
Max möchte in Berlin studieren. Seit einigen Monaten lernt er deshalb Deutsch.
It is no different when the adverb deshalb occurs in subordinate clauses, as it does in the relative clause in your example.
Hast du gehört, dass Max in Berlin studieren möchte und (dass er) deshalb Deutsch lernt?
einen kleinen Hund, von dem sich meine Kinder nicht trennen können und den wir deshalb mitnehmen müssen
Since you asked about the meaning: deshalb connects the two relative clauses in such a way that the first gives the reason for the second. A paraphrase would be:
einen kleinen Hund, den wir mitnehmen müssen, weil sich die Kinder nicht von ihm trennen können
Word such as weil, obwohl, wenn etc. are known as Subjunktoren; they invariably introduce subordinate clauses. When using terms such as Konnektor, it is important to realise that the term unites parts of speech that behave completely different, i.e. adverbs such as deshalb, trotzdem, dann (which are flexible in the manner shown above) and subjunctions such as weil, obwohl, wenn, which invariably introduce verb-final subordinate clauses. (Then there's also conjunctions such as und, oder, denn, which again behave in a different manner.)