This is normally achieved using a series of kernel patches (the kernel being fundamental software in the operating system). Jailbreaking allows root access to the iOS, allowing the download and installation of apps, extensions and themes that are not available through official stores.
Why is it done?
In iPhones, one of the main aims of jailbreaking involves pirate apps and games. The official Apple store has control over the installation of practically all consumer software, which is, to a great extent, paid software.
This is why the legitimate developers, particularly Apple itself, have a keen interest in stopping this practice. In any event, jailbreaking is not the only means that users have for bypassing these restrictions; there are other ways such as the installation of pirated apps, using certificates stolen from the company.
Another main reason for jailbreaking can be to extend free app features way beyond those that Apple and the App Store offer users. Apple checks whether apps comply with the iOS Developer Program License Agreement before granting permission for an app to be distributed through the official store.
This technique can be used for logistic as well as financial reasons. For example, in markets like China, there are many who use this technique to install locally developed apps that have not followed the official Apple channel.
On the other hand, there is also the personalizing and improvement of devices. Much of the software available through alternative platforms, which do not comply with official Apple regulations, are extensions and customizations (known as tweaks).
Users can use these programs to personalize their device interface, for example, with the creations of alternative developers and designers, adding features or correcting problems that the developer might take longer to correct. With access to the file system and command line tools, advanced users can make these improvements directly.
The risks of jailbreaking
There are however other, more harmful uses. Cyber-criminals can attack jailbroken iPhones to install malware. There have been cases where the security forces have used jailbreaking to monitor the devices of suspects or persons of interest.
Modifying devices to use free software has medium-term and long-term risks. By straying away from official stores, your device will be more vulnerable to downloading malware, as your first line of defense is the official developer. Official platforms inspect everything before making them available to customers. Last year, for example, Google Play Store eliminated more than 700,000 apps.
Although developers cannot guarantee to remove 100% of threats, they remain an important filter.