The problem, although common, is purely individual, depending on the device model. Try to find a similar situation on the Web or video services.
Depending on the manufacturer of your device, the firmware process will be different. Devices on Qualcomm chips are usually flashed via Fastboot, on MediaTek - via the SP Flash Tool. For example, here is an excellent instruction on this topic: https://4idroid.com/kak-proshit-android-planshet-smartfon-kastomnaya-proshivka/. You can also flash your phone through custom Recovery: TWRP or CWM. And for other smartphones and tablets there are proprietary utilities like Samsung's Odin.