So, there are several factors.
The universally important four factors are:
Planet hazard rating - this doesn't modify gross income, but it does multiply maintenance costs; an industry that turns a decent profit on a 75% terran world might be a net loss on a 300% hazard gas giant.
In-faction production - again, doesn't modify gross income, but the more of your demand can be satisfied by other planets you control, the lower your maintenance costs.
Edit: Note that this bonus applies to the colony as a whole, not on a per-industry basis. Mouse over the income in the planet management screen to get the tooltip telling you what the value is for a given colony.
Stability - high stability is (currently) a multiplier on profit generated. Get it to 10.
Accessibility - caps how much of a thing you can sell; also impacts market share (which determines how much you get from selling it).
After that, you get to the per-industry variables.
Mining: Depends a lot on what resources are available. It's theoretically possible to find planets with minerals and rare minerals and organics and volatiles, but more often you'll need to construct mining on multiple planets to cover all the resources. High tier deposits of rare minerals and volatiles are generally the most profitable, but it's good to have all four for the in-faction production bonus - assuming that the deposits are good enough; a poor deposit won't really help.
To get the really good deposits, you will probably have to build mining on a high-hazard world.
Refining: Tends to be highly profitable, especially if you can actually keep it fed with in-faction mineral production.
Farming: If you can build it, it'll be decently profitable. Not awesomely so, but decent, in large part because the maintenance cost is low.
Fuel production: If you don't have a synchrotron, don't bother. If you do, build this on a low-hazard world and make bank.
Heavy Industry: Profits tend towards 'meh', but it can still make a decent amount if you put it on a low hazard world and install a pristine nanoforge. Then again, profit isn't really the point of heavy industry; this is what lets you make use of all those blueprints.
Light Industry: Low profitability, unless you build it somewhere that has free port turned on - at which point it will make drugs, which are high value, but (as a free port) will also attract punitive expeditions from the Luddic Church and the Hegemony. May still be worth having one of even if you aren't using free port anywhere, just to get that in-faction production bonus on the rest of your colonies.
Commerce: In 0.9.1, does not generate any profit. Do not build.
Military Base: Does not generate any profit. Still worth having at least one per system, just for the added resilience against hostile expeditions.