A private key is simply a number, picked at random. The private key is used to create signatures that are required to spend Bitcoins by proving ownership of funds used in a transaction. The private key must remain secret at all times because revealing it to third parties is equivalent to giving them control over the Bitcoins secured by that key.
Private keys are also used to generate public addresses, where the Bitcoin or other cryptocurrencies are sent and received. The cryptographic process makes it easy to generate a public address from a private key instantaneously, but it is nearly impossible to reverse the process and determine the private key from the public address. A private key is made up of 51 alphanumeric characters, which increases the difficulty of cracking the key and adds a layer of security.
You can think of the public address like a mailbox, and the private key is the key that opens the mailbox so the holder can collect whatever might be inside. This is why it is so important to keep your private keys secret, because whomever knows the private key can take the Bitcoin at any related public address.
Private keys are stored in digital wallets, which can be either online, as an application on your computer, or offline like hardware and paper wallets. When a transaction is made to send Bitcoin the wallet creates a digital signature using the private key to let the network know that it is a valid transfer. It also ensures that the transaction cannot be altered. If a user loses their private key, the Bitcoin stored with that key are lost forever.