All you need to know to make tons of money in OpenTTD is this:
wiki.openttd.org/Cargo_income
It may look complicated by basically boils down to this
1. Distance increases payment. You need to transport relatively far to get decent income. It's much better to do very long rounte then a very short one. And if you want to be perfectly effecient there is an optimal income distance, but it varies for different engines and settings, here is a tool that helps calculating it in some cases:
citymania.org/tools/profit
2. Diagonals are more profitable. Because manhattan distance is used for payment it is doubled on diagonal and travelling time is only increased by 50% so overall you get 33% more money on diagonals.
3. Some cargos are better for making money than others. Because of higher payment rates, higher capacity wagons or less weight. Speaking of weight, cargo multiplier doesn't increase weigth of passengers making them even more unblanced then they already are.
4. Travel time decreases payment. So max speed is very important. Your trains also need to have enough power to get to max speed relatively quickly. Though once your building speed is high enough you may also consider buying cheaper vehicles at start since you can make more of them. For example on default train set this makes SH125 the best starting loco, even if monorail or maglev is available.
5. Empty trains don'm make money, use full load and transport cargo both ways. It's very easy with passengers, but you can do 2-way routes with other cargo too.
Once you master this it's pretty much impossible to go bankrupt, at least if settings are even remotely reasonable. And after that only this that matters if you have enough money to build more stuff or you just have to sit and wait untill you get enough which is simply boring.