Summarize this article:

It's the blue compass-shaped app in your Mac's Dock.  Make sure that you open Safari in window mode rather than full-screen. If Safari is already open and in full-screen mode, hover your cursor at the top of the screen, then click the green button in the upper-left side of the screen when it appears. This menu item is at the top of the screen. Clicking it prompts a drop-down menu. It's near the bottom of the View drop-down menu. Doing so should bring your toolbar back up.  You can also click Show Path Bar and Show Tab Bar here if you're missing the URL text box or the tab view at the top of Safari. If you see Hide Toolbar here instead, click Hide Toolbar and then click Show Toolbar to re-activate it. To do so:  Click View  Click Customize Toolbar...  Click and drag items from the menu up onto the toolbar. . If your toolbar keeps disappearing even though you've activated it, you may have a piece of malware on your Mac that's preventing the toolbar from loading when you open Safari. A virus scan should help remove the malware.
Open Safari. Click View. Click Show Toolbar. Customize your toolbar. Run a virus scan