Open (Applications → Utilities → Terminal) and run:

Double-click the .dmg file to mount it. If it contains a .pkg file, run it; this typically installs a "Install macOS [Version Name]" application into your Applications folder.