The interaction of ultrashort, high intensity laser pulses with thin foil targets leads to ion acceleration on the target rear surface. To make this ion source useful for applications, it is important to optimize the transfer of energy from the laser into the accelerated ions. One of the most promising ways to achieve this consists in engineering the target front by introducing periodic nanostructures. In this paper, the effect of these structures on ion acceleration is studied analytically and with multi-dimensional particle-in-cell simulations. We assessed the role of the structure shape, size, and the angle of laser incidence for obtaining the efficient energy transfer. Local control of electron trajectories is exploited to maximise the energy delivered into the target. Based on our numerical simulations, we propose a precise range of parameters for fabrication of nanostructured targets, which can increase the energy of the accelerated ions without requiring a higher laser intensity.