here read this:
https://androidforums.com/threads/general-rooting-discussion-please-read-before-posting.898388/
the info there is a bit old, but it still applies. there are links to more root info as well. i would read those as well.
also keep in mind that not all devices can be rooted. and some devices are harder to root than others.
rooting in this day and age is not as needed as it once was. back in the day people rooted to get rid of bloatware and to have more room on their device. some people rooted to increase performance as well. but all of those issues have been addressed with most flagship phones. i have no reason to root my note 10+ 5G as it does everything that i want it to do. but for some, they have a low to mid tier phone where performance and storage are an issue.
but that is not all the reasons to root. i think it is fun to try out new custom roms. every time you flash a custom, it is like getting a new phone. also when you are rooted you can get rid of bloatware yourself. plus some developers have developed custom kernels which can increase speed and make your battery life better.
but there are risks to rooting. if you do not know what you are doing, you can brick your phone.....meaning if you mess up, your phone is forever broken. most of the time when you brick your phone, it is dead for good......so you need to read a lot, before attempting to root. some root exploits will trip security and may prevent certain apps from running. for example on Samsung phones, rooting will trip Knox and it will let anybody trying to repair the phone that the phone is rooted and they will probably not fix it. rooting does void your warranty. and most banking apps will not run on rooted phones.
and lastly not all phones are rootable or have any support from developers. over at
https://www.xda-developers.com/ is where you want to go to find out rooting your specific device. this is a forum where developers hangout and publish their goodies. if you do not find a forum for your specific device, then that means that there is no support from developers. no developers means no root methods, no custom roms, and no fun.
the key to rooting really is to do your research and read as much as you can before attempting to do anything.
i hope this helps.