Keyboard history
History of development of the current computer keyboard, its layout and keys.
Introduction
Your computer keyboard has interesting ancestors that come from the end of the 19th century. These are typewriters, and teleprinters – basically like typewriters but for telegraph communications, and the history of their layouts is quite interesting. It's even more interesting that teleprinters and typewriters were invented practically in the same period, so they share the history of the layout of their keys.
Typewriters
Typewriters differed vastly from manufacturer to manufacturer in the early days. Along with now traditional "keyboard typewriters" you could encounter index typewriters, which required the user manually selecting a key from the index, usually one at a time. The latter became surprisingly widespread because the mechanism was less complex. However, but they were much slower to operate than keyboard typewriters.
Keyboard typewriters had 6 rows to accomodate both uppercase and lowercase letters before the shift key was invented. By the way, most of them were "frontstriking" back then, which meant the typists couldn't see what they type – the typed text was on the other side of the mechanism!

Hansen Writing Ball typewriter
By around 1910, typewriters became standardised. It was universally decided that the best form-factor is the keyboard typewriter with three rows of keys, QWERTY layout, a wide spacebar, and a shift key. The keys on these typewriters were intentionally misaligned to not allow metallic arms which held the keys to overlap and jam. Later delevopments include the backspace, caps lock, return key, tab key, control key, and dead keys. By the time typewriters became electric, their keys got the familiar square shape.
That's why today most computer keyboards use staggered key arrangements, the same non-character keys, et cetera. All attributed to almost a century of typewriter innovation.

Underwood 1 typewriter
Teleprinters
Teleprinters were used for communication, not typing on paper. Their earliest usecase was for telegraph systems: operators used teleprinters to type messages which were sent to the receiveing teleprinter by wire. The first models differed from each other in various ways, as with typewriters. For example, some teleprinters used a row of piano keys with labels as their keyboard in the end of the 19th century. Often, the term "teleprinter" was omitted and the entire assembly was simply named "telegraph system".

Hughes letter-printing telegraph system
However, teleprinters, or teletypes, as people also started to call them, soon became pretty standardised along with typewriters, sharing the design of their keyboards. Some people say that telegraph operators influenced the position of the keys in what has eventually become the QWERTY keyboard layout.
These machines proved useful in enabling the world to transmit information and communicate faster than ever. During the two World Wars, teleprinters and telegraph systems were used extensively by all nations, and in the peacetime, a global teleprinter network called "Telex" was established. With "Telex" being useful to the world's financial institutions, big news companies all around the globe used their teleprinter networks to send entire news articles across their departments, or to share the news with their colleagues overseas.

ITT Creed Model 23B teleprinter for Telex
With the Information Age approaching, another use was found for teleprinters – they were to become an interface between a computer system and a human. They were used as computer terminals, enabling researchers to send input to a machine by typing a command on the keyboard or inserting a punch card, and receive an output on a paper sheet, printed by a teleprinter. This marked the birth of the command-line interface (CLI), still widely used in computing. Teleprinters were replaced with dedicated computer terminals or video display units (VDU) during the second half of the 20th century.

Intelex teleprinter
Teleprinters brought the Ctrl
key to the contemporary
computer keyboards. Back then it was used for operations that didn't
involve typing characters, and it's still used to send commands to our
machines, not letters and symbols.
QWERTY layout
QWERTY layout became popular with the Remington 2 typewriter. Both were invented by an american newspaper editor Christopher Latham Sholes, and is said to be influenced by feedback from telegraph operators and the study of bigram (letter-pair) frequency by educator Amos Densmore. Fun fact: you could (and still can) peck "type writer" only using the top row of the keyboard.

Remington 2 typewriter – the first with a QWERTY layout