Dr. Rank functions mostly as a foil to the other male characters. Rank is a sympathetic man who appears to have loved Nora "from afar" for a long time. His position is made all the more pathetic by the revelation that he is ill and dying.
The contrast could not be greater between Rank and both Torvald and Krogstad. Though Torvald is not really a bad man, at least by the standards of the nineteenth century, he shows little regard for Nora's feelings as a person. He reacts angrily and defensively to any opinions she expresses that don't echo his own, and in general he treats her more like a pet than a woman. At the same time, there is a kind of slickness to his character. He arrogantly believes he has everything under control. When this bubble of illusion has burst with his reading of Krogstad's blackmail letter, he unleashes a furious tirade at Nora which more than anything simply reveals his own fear and cowardice. Rank, on the other hand, is a calm, resigned man who, perhaps because he knows he's dying, is without fear. To put it simply, he's the only male character in the play who is kind to Nora.