Unless you are planning to go off-grid (which is quite stupid as energy storage is best done on an industrial scale as hydrogen stored underground, and not on a single-home scale in batteries, as batteries are very expensive), there are only two satisfactory answers to this question:
If the cost of solar panels is so high that the annual yield of your investment, taking into account depreciation of the installed panels, is below that of an alternative investment such as a well-diversified stock portfolio, the best bet is to not install these panels at all. Doesn't make sense to invest in something that produces only very little yield.
If the cost of the solar panels is so low that the annual yield of your investment exceeds that of other alternative investments such as a well-diversified stock portfolio, cover all suitably oriented surfaces of your roof with solar panels. In fact, if you have unused land area, you could also install even more solar panels on the ground.
So if solar panels are worth it, the amount of panels to install is determined by the amount of area you have for these panels. Better to use all of the area as opposed to using only half of the area.
My opinion is that there probably aren't very many places where the price of electricity is so high and the labor rate for installing panels is so low that solar panels would make sense on the small scale for a single home. Also, you have to consider what happens if everyone installs solar panels. Then the price of electricity becomes very dependent on sunshine, i.e. when you have the most sunshine, the price of electricity is zero due to excess production and then your panels aren't producing any revenue at all.