Ransomware is a type of malware (software intentionally designed to cause damage to a computer, server or computer network), that threatens to publish the victim's data or perpetually block access to it unless a ransom is paid. While some simple ransomware may lock the system so that it is not difficult for a knowledgeable person to reverse, more advanced malware uses a technique called cryptoviral extortion. It encrypts the victim's files, making them inaccessible, and demands a ransom payment to decrypt them. There are a several means how ransomware can access a computer. One of the most common is phishing spam — attachments that come to the victim in an email, looking like a file they should trust. Once they're downloaded and opened, they can take over the victim's computer. There are more things the malware might cause once it’s taken over the victim's computer, but by far the most common action is to encrypt some or all of the user's files. the files cannot be decrypted without a mathematical key known only by the attacker. The user is presented with a message explaining that their files are now are now inaccessible and will only be decrypted if the victim sends an untraceable Bitcoin payment to the attacker.
As malware attacks become more frequent, attention has begun to shift from viruses and spyware protection, to malware protection and programs that have been specifically developed to combat malware. Ransomware is one of the biggest security problems on the Internet and one of the biggest forms of cybercrime that organisations and users face today. Ransomware attacks surged by 150% in 2020 with the average extortion amount doubling. The total amount paid by ransomware victims in 2020 reached nearly $350 million worth of cryptocurrency.
There are of course defensive steps you can take to prevent ransomware infection. These are a good security practices in general, so following them improves your defenses from all sorts of attacks:

Keep your operating system patched and up-to-date.
Don't install any software or give it administrative privileges unless you know exactly what it is and what it does.
Install antivirus software, which detects malicious programs like ransomware and also a software, which prevents unauthorized applications from executing in the first place.
And, of course, backup your files, frequently and automatically! That won't stop a malware attack, but it can make the damage caused by one much less significant.