It works in the same way as other messengers, type a message, tap on send button, it gets encrypted by the Telegram and sends to the recipient or targeted user who only has the decryption once connected. Thus, only the recipient of Telegram whom you have sent the message with the help of key will be able to read your messages. All your messages first go to Telegram Cloud server and then from there to the determined user. This is just layman info otherwise lots of things happen at the back end to securely and safely deliver the messages.