MacOS lets you set a time for how long your MacBook's display stays on during a period of inactivity before it shuts off to reduce energy usage and increase battery life. You'll find a slider that goes from 1 minute to Never in the Energy Saver panel of System Preferences. There's a slider for when you are running on battery power and another for when you are using the power adapter.
If you want to keep your MacBook awake during a long download or just want to keep the display from dimming while you are watching a video that's not in full-screen, there are better ways than digging into System Preferences, adjusting one of the aforementioned sliders and then remembering to move the slider back to where you want it for normal operation. The first way involves a free app, and the second involves Terminal.
1. Owly app
No, not that Ow.ly, but this Owly, a free app you can find in the Mac App Store. It places an icon in the menu bar, that lets you enable the app to run from from 5 minutes to eternity. You can also right-click the coffee-cup icon to start it running at its default duration. Right-click it again to turn it off.
The Owly icon turns red when the app is running, and if you choose one of the timed increments, the app places a timer next to the icon. You can turn this timer off in the app's preferences, as well as set a default duration and have the app disable itself if the remaining battery dips below a certain percentage.
2. Terminal command
If you don't want to install an app to keep your MacBook awake, then you can turn to Terminal. You'll find Terminal in Applications > Utilities but you can also just search for it with Spotlight.
With Terminal open, enter this command: caffeinate
You'll know the command is working if you see "caffeinate" in Terminal's title bar. To disable the command, using the keyboard shortcut Control-C. That is, do not type "control" but hold down the Control key and then hit the C key.
In related news, learn how to keep a Chromebook from falling asleep.