How does the telegraph work?

How does the telegraph work?