1. He will hit the boy with a pen.

---------------------------------------
Does 'with a pen' modify 'will hit' or 'hit'?
Does 'with a pen' modify 'the boy' or 'boy'?

Wow! It could be either!!

Will he hit the boy who has a pen?
OR
Will he use a pen to hit the boy?

It could mean either one. If you want it to modify "hit" though, you should move "with a pen" closer to the verb: "With a pen, he will hit the boy."