하필(이면) roughly translates to 'of all the things'. It is used negatively to show that you are surprised/exasperated and unhappy that something very unlikely has occured:
여보, 왜 하필이면 모든 날 중에 오늘 친구가 우리집에 와요? 결혼기념일이에요! Honey, of all the days, why did your friend have to come today? It's our wedding anniversary!
왜 하필 모든 사람 중에 그를 초대해요? 그 사람을 상대하기 싫어요!
Why did you invite him of all people? I can't stand his company!
하필이면 모든 물건 중에 등산에 휴대폰만 가져왔어요. Of all the things he could bring on hike, he only brought a smartphone.
왜 하필 그 나라에 간 거예요? Why are you going to that country of all places?
하필이면 왜 많은 날 중에 오늘이에요? Why today of all days?
하필 그 날에 그의 결혼식날은 비가 왔다니. It rained on their wedding day, of all days.
왜 하필이면 학생이 제 옆에 앉아요? Why does he, of all students, have to sit next to me?