In the beginning, people used electricity for magic tricks by creating sparks and shocks. Electricity wasn't "useful" yet.
Benjamin Franklin was very interested in electricity and lightning. He noticed several similarities between the two: They both created light, made loud crashes when they exploded, were attracted to metal, had a particular smell, and more. Then he had an idea.
Franklin wrote up his thoughts on electricity in several letters to a fellow scientist who lived in London. This scientist and other scientists in London thought Franklin's letters contained valuable information, so in 1751 they published them in a little book, Experiments and Observations on Electricity.
One of the letters contained Franklin's plan for how to prove that electricity and lightning were the same. His plan required something tall, like a hill or a tall building, but Philadelphia had neither at the time. Franklin came up with another plan. This one involved a key and a kite.
Franklin needed something to get close enough to the clouds to attract the lightning. He did have a silk handkerchief, a couple of sticks and some string, so instead of getting himself up near the lightning, he flew a kite up to it. And it worked!
He knew that lightning usually hit the highest part of a building. So he invented the lightning rod. A lightning rod is made of metal and is attached to the highest point on a house. The lightning hits the rod instead of the house, the electrical current goes into the ground and leaves the house undamaged. Franklin thought the lightning rod was his most important invention.