The BIOS is a 16-bit program running in real mode, and in this mode it is possible to address only 1MB.
This is incorrect.
16-bit real mode does not limit the processor to 1MB of memory.
While it's true that an x86 processor starts out in real mode, and defaults to the 16-bit 8086 instruction set, there are extensions in the 80286 instrution set. If you prefix an 8086 instruction with the byte 0x67, this will allow that instruction access to a 32-bit register, which has access to 232 bytes, or 4GiB of memory.
If you are using a 64-bit processor, the processor can use PAE (Physical Address Extension), which gives the processor access to 252 bytes of memory, more than can be physically installed on any modern motherboard.
Source How BIOS can detect full extended memory size
How does the BIOS determine the amount of available RAM, like 1 GB for example?
It uses methods that are documented in the datasheets for the memory controller (northbridge).
Most BIOSes can't use any RAM until they detect the type of RAM installed, then detect the size of each memory module, then configure the chipset to use the detected RAM.
All of this depends on chipset specific methods, and is usually documented in the datasheets for the memory controller (northbridge).
The RAM is unusable for running programs during this process. The BIOS initially is running from ROM, so it can play the necessary games with the RAM chips. But it is completely impossible to do this from inside any other program.
Source Detecting Memory (x86)