You can add the Protection enchantment to any piece of armor such as helmets, chestplates, leggings or boots using an enchanting table, anvil, or game command. You will then need to wear the enchanted armor to gain the protection. The maximum level for the Protection enchantment is Level 4.
Is Prot 4 rare?
You can't get a prot 4 book by enchanting. You need 2 prot 3 books and combine them in an anvil (as the comment below also says!) You can get protection 4 at an enchantment table.
How do you get a prot 4 enchantment table?
Librarians have an even chance of having a trade for any enchanted book (such as protection 4). If you keep braking and replacing the lectern, you should eventually get a trade for protection 4. Just make sure you lock the villagers trade by trading with him as soon as you get the protection 4 trade.