Simple answer: When you want that information/functionality to be visible/accessible at all times and the page has a long scrolling content.
Screen space is a resource to be used wisely. One, because usually you have more information than can fit in one screen, and, two, everything that is on the screen imposes a cognitive load on the user. So you just have to weight gains/costs of every feature you put on the screen.
We want users to feel good and be productive whenever using our products/software/apps. So we try to make it easy for them. Does the fixed bar make their work more productive/easier? Or just use up screen space by presenting logo and some unnecessary links/functions user is not very likely to use?
Some cases, when fixed bar is a good idea:
- The page is vertically long and user might want to quickly access top menu without having to scroll all the way up (or looking for Home key on the keyboard, which I think very few users use to return to the top).
- User needs to see some information at all times wherever they are on the page (like incoming messages, alerts etc, or table column headers when the table is very long etc.).