Modifying and extending recent ideas 1 , a theoretical framework to describe dissipation processes in the surfaces of vibrating micro and nanoelectromechanical devices (MEMS-NEMS), thought to be the main source of friction at low temperatures, is presented. Quality factors as well as frequency shifts of flexural and torsional modes in doubly-clamped beams and cantilevers are given, showing the scaling with dimensions, temperature and other relevant parameters of these systems. Full agreement with experimental observations is not obtained, leading to a discussion of limitations and possible modifications of the scheme to reach quantitative fitting to experiments. For NEMS covered with metallic electrodes the friction due to electrostatic interaction between the flowing electrons and static charges in the device and substrate is also studied.