At work, it is wrong to simply say 分かる to say that you understand something. In what situation should I opt to use one of the previously mentioned forms?
かしこまりました is by far the most formal, and is a humble form (謙遜語). It says that you are inferior to the listener. Most specifically this should be used to interface with customers (hence why wait staff at a restaurant may say it).
承知しました is polite (〜します), but not humble. It is also appropriate to use with customers or superiors.
了解です is also polite in form, and is not humble, but has a certain curt feeling to it (this could be from its usage by the armed services as "Roger"). Informally friends and family often say/text 了解 (without the です) in a context where they want to say "Yep, got it".
The difference between the latter 2 is nuance, I suppose. Both seem to translate as "I acknowledge and understand". My gut feeling having worked in a Japanese office is that 了解です, while polite, isn't formal enough for customers. 承知 is better for customers or superiors.
I just want to add one point to other nice answers: 了解です is not a proper polite form for this meaning. The proper polite form is 了解しました. Saying 了解です instead of 了解しました is acceptable and many young people use it but decreases the formality level. It shows an attempt to be polite, but at least if it is used by an educated native speaker of Japanese, it may imply that the speaker is not bothering to use a proper form, which may decrease the politeness. If you go this informality one step further, you get 了解っす which is even less formal (see another question).
かしこまる／承知する are used mostly for answering requests from superiours (bosses, clients, etc.). Like, "Yes, I understand what you're asking me to do (and I'll do it)." 分かる just implies you mentally understand.
了解 is not formal as far as I know, and I hear it quite often. I learned it to mean almost like "Roger!" or "copy that".
In my experience
→Ryoukai(了解）、most Polite:Ryoukaiitasimasita(了解致しました)is generally used when you say ok and i will follow it or i will do it as accordingly. Generally after saying this you are supposed do something. →Syouchi(承知しました）most polite:Syouchiitasimasita(承知致しました）is normally used when you need to say i understand.genrally after saying this you are supposed that you knew, learned something.
Mostly the usage. Remember, first, that Sino-Japanese is almost always more formal than native Japanese.
- かしこまる is for use with customers. "Right away, sir." It literally means "to take a humble/respectful attitude" (新和英大辞典).
- 了解 is used in the military. "Affirmative/Understood". See final fantasy VIII. Used all of the time by groups when they want to show that they understood and will follow what they are told.
- 承知 is a very formal way of saying you understood. Also used very often in customer service.