Nivolumab works by inhibiting the PD-1 pathway, which tumors exploit to evade immune detection. By blocking this pathway, nivolumab enhances the body's immune response against cancer cells. This makes it a valuable option in immunotherapy for gynecological cancers.