What is the best way to put up a single shelf at top of wall to go all the way around the room for books
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
If you're sagging in the longitudinal direction, support lengthwise. If you can brace or support the entire length of the shelf, you can avoid a lot of the sagging. Sometimes even so much as adding a font lip will go a long way to making the shelves sturdier. Even a 1/2" x 1" strip, fastened with glue and countersunk wood screws will go a long way.
If even more weight needs to be supported, I've painted aluminum angle to the bottom of 40"x 26" MDF Shelves so they support Audio equipment in a cheap entertainment center, supported only by 4 steel pins.
Just remember, whatever you add shouldn't be so heavy as to take away from the load the shelf is intended to carry.
I.E. 2" steel angle on 1" thick boards as shelves may be overkill (ask me how I know)
You will need regular supports to hold the shelf up from sagging. For books, you will need your supports anchored in the studs and since those are every 16 inches, you will need one every 16 inches. If you were to put a support every other stud (32 inch spacing), even 3/4 plywood would sag about a 1/10 of an inch. If you go with supports every 16 inches, you can get by with 5/8 plywood. For supports, use any bookshelf support you like.
If you use MDF instead of plywood, you will need 3/4 inch with 16 inch spacing on the supports.