How to predict the decomposition products of for example barium carbonate? I am a high school student studying basic chemistry and I am confused about the process of writing decomposition reactions.

The question I have encountered asks me to decompose $\ce{BaCO3}$.

Online, I have found that this decomposes to $\ce{BaO + CO2}$.

My question is, essentially, is there a method to determine which elements go where. I'm having trouble finding answers.
Chemistry, despite being several hundred year old science, it is still very much empirical. In the beginning you will have to learn and accept some facts. Later you will start to see patterns (hence the periodic table). If you learn that the carbonate of barium decomposes into carbon dioxide and barium oxide, it will be safe to say that Mg, Ca, Ba, Sr, will do the same. Here you have learnt four more chemical reactions. If you recall the periodic functions in mathematics, which repeat themselves periodically, in the same way, elements repeat their properties in the periodic table.

When you strongly heat inorganic salts, usually you get smaller products (e.g., carbon dioxide and barium oxide) which are energetically more stable with respect to the starting material.