Question: should login/signup appear before or after the navbar?
(question clarified by OP)
In short: If it's in that top right corner, then it doesn't matter very much.
Top-right consoles are rarely perceived by users, because the F-Pattern shows that users rarely scan that corner unless they are specifically looking for something.
Therefore, if you want to draw user attention to signup/login, then consider another more visible placement or more eye-catching cues (bright colors, large buttons, etc) to accomplish this.
If you don't need to draw user attention to signup/login, then I think you can safely optimize for other UX goals like grid layout and simplicity.
Generally, the way I've seen this decision play out:
If the nav bar is short (e.g. Shopify) then signup/login is placed inline with the nav bar because it results in clearer and simpler grid alignment and reduces onscreen clutter.
If the nav bar is long (e.g. Optimizely), then signup/login is placed in another location (where it can be de-emphasized) because designers want to avoid wrapping the nav bar for responsive layouts.
Usually #1 is preferred over #2, but constraints sometimes make it impractical.
Hope that helps (this time round)
Question: Optimizely vs Shopify signup layout?
There is no best practice here.
The best approach depends on what your UX goals are.
For the Shopify website, the main call to action on the page is the sign up form at the bottom. The black callout, green button and blue outlined and focused text box all draw the eye to the sign up form. So it's likely that sign ups are one of (or the) priority goals for their home page.
For the Optimizely website, you've shown only the navbar and not the full page so it's hard to tell whether there is a call to action.... But irrespective, the sign up seems clearly not to be the principal focus of the page so they may have other UX goals such as educating the user to the product, or providing a guided path to a sales call rather than a sign up.
For your site I'd suggest figuring out what's important to you before determining sign up placement. Placement comes at a cost, so if you're tempted to use the Shopify layout to encourage sign ups remember that it comes at the cost of using that valuable real estate to accomplish some other UX goal.
Hope that helps