Let's say we have Alice and Bob in a chatroom, trying to communicate. They're connected to the same network, but we have the network admin constantly monitoring all data being sent to servers (and received from servers, for that matter). How would they be able to send messages to each other without the Administrator being able to see? Assuming they're sending plaintext messages, nothing complicated
You might be interested in PGP communication: http://www.pitt.edu/~poole/PGP.htm
Both of you would generate a public key-private key pair on your local systems. Each key pair is mathematically related, that is, a public key is related to its private key. You would then publish the public key, well, publicly for everyone to see. The idea is anyone can encrypt a simple plaintext message using your public key and send you the result. Only you would be able to decrypt the message using your stored private key.
So in this case, Alice would tell Bob their public key, in the chatroom or somewhere else. Bob then uses Alice's public key to encrypt a secret plaintext message, then posts the result on the chat service. Alice grabs the encrypted message from the chat server and decrypts it at their local machine using the secret private key. Similarly, communications from Alice to Bob are also encrypted using Bob's public key.
The steps involved in generating a public key-private key pair are listed here: http://www.seas.upenn.edu/cets/answers/pgp_keys.html