难怪 can be used to express that the speaker finds something unsurprising. It can be used alone or in a variety of different structures, as shown below.
难怪 as "it is not surprising that"
Here 难怪 is used to convey the speaker’s lack of amazement at a situation, having recently acquired some new information that in his opinion explains it. It is used in much the same way as 怪不得, which can replac 难怪 in the structure without altering its meaning.
小张 请假 了，难怪 今天 没有 看到 他。
难怪 这里 人 这么 多，原来 在 打折。
难怪 as "is not to be blamed"
难怪 他，他 还 是 个 孩子 呢，什么 都 不 懂。
难怪 as "inevitable"
Similar to 难免，here 难怪 operates as an adjective meaning that something is inevitable.
这么 多 工作，忘 一 件 是 难怪 的。