Whenever you close the game and come back, you get 50% of the resources and Research Points that you would have gotten during the time you were offline (source). So, first things first, in order to optimize your production you should let the game run.

However, unlike other idle games where you simply receive everything in a neat little packet when you log in, this game gives it to you in the form of a game acceleration, during either 60 seconds (1 minute) or 10 minutes, depending on the setting of the "10 minutes idle bonus" toggle on the Info screen. That speedup can be up to 100x during 10 minutes, or 1000x for 1 minute. Or in other words, the idle bonus caps at 2000 minutes (~33,33h) offline.

The game acceleration/idle bonus affects everything (resource production and consumption, fleet travel times, etc). So it's very useful to shorten the times needed for market trades.

This can also be used for cheating.