The Lightning Network (or just Lightning) is a second-layer technology built on top of the Bitcoin blockchain that enables faster transactions with little or no fees.
Bitcoin is built on what is known as blockchain technology. The blockchain ensures that all transactions are documented in a tamper-proof manner. A transaction is not considered confirmed until it has been recorded in a block. However, a new block is usually only calculated every ~10 minutes, so current transactions remain on the blockchain forever. For example, if you wanted to buy something in a store with bitcoin, it would be inconvenient to have to wait 10 minutes for the transaction to be confirmed. Bitcoin can also incur relatively high transaction fees. For these reasons, the Lightning network was developed.
The Lightning Network
Lightning (named after the speed of lightning ⚡️) uses the Bitcoin network as its basic infrastructure and builds its own network of payment channels on top of it. A payment channel works much like a credit account with a merchant (e.g. Amazon). You need to create a channel once with a Bitcoin transaction, and then you can use it until your credit is used up or the channel is closed. Channel transactions are both extremely fast (almost instantaneous) and very cheap.
Moreover, it is not necessary to set up a separate channel for each transaction; it is sufficient to use existing channels of other users. Here is an example:
Store XY allows payment in bitcoin via Lightning. Alice has an existing Lightning channel for store XY. Her friend Bob also wants to pay there with bitcoin, but does not have a direct channel open to store XY, but does have a channel open to Alice. Bob can still pay at store XY through the channel to Alice. This creates a huge network of payment channels that can be used worldwide for cheap and instant payments.
Lightning wallets typically take care of creating, closing, etc. channels for users so that bitcoin payments can be made via Lightning in a straightforward manner.
Risks of the Lightning Network
The Lightning network has been tested millions of times and is generally considered to be very secure. However, in exceptional cases, there is a risk of transactions failing or channels being unilaterally and spontaneously closed, which can sometimes result in the loss of the bitcoin balance. We therefore recommend using the Lightning network for smaller (possibly recurring) payments.