First you need to decide how you start the IWDG: automatically at power on reset (through option bytes) or "manually" by software. I recommend the software mode, at least while you still learn....
The IWDG is quite simple. You set the timeout period writing the 2 registers IWDG_RLR and IWDG_PR (see ref. manual), than after you enable it, you just have to make sure you refresh it before it times out.
So, you need to generate a refreshing period, usually with a timer, that is lower than the IWDG timeout period. It is important if you generate the refreshing period within an interrupt that you don't reset the IWDG inside the interrupt routine - i.e. this would not brake an infinite loop if interrupts are enabled!
Below an example written in assembly, with 18ms timeout, you can easily pass/adapt it to any C compiler you use:
Start_Iwdg:
; Timeout = (1/38kHz)·PS·(RL+1) = 16·(RLR+1)/38 = 18 ms
; RLR = 18·38/16 -1 = 41,75 --> 42
; Timeout = 16·43/38 = 18,1 ms
mov IWDG_KR, #0x55
mov IWDG_RLR, #42
mov IWDG_KR, #0x55
mov IWDG_PR, #0x02
ld A, #0xCC
ld IWDG_KR, A
ret
....and somewhere in a 10 ms periodic handler reset iwdg
mov IWDG_KR, #0xAA
....