A study of the physics of separating and reattaching flows around bodies with sharp edges is reported. Data from direct numerical simulations of the flow around a rectangular cylinder with aspect ratio 5 at different Reynolds numbers are used. The flow is decomposed into multiple interacting flow phenomena such as the laminar boundary layer in the front face, the separated shear layer, the flow impingement at reattachment, the reverse boundary layer within the recirculating bubble and the near- and far-wake flow. A detailed analysis of the physics of these phenomena is provided, including the slow modulation induced by large-scale instabilities related with vortex shedding. The entrainment phenomena acting along the separated shear layer and their unbalance between its inner and outer sides are recognised as fundamental mechanisms determining the tendency of the flow to reattach and the overall fluxes of momentum and heat. The behaviour of entrainment is found to be strictly related with the shear-layer velocity difference that in turn is determined by the behaviour of the reverse boundary layer and by its strength in counteract adverse pressure gradients. The physical understanding of the compound role played by these and all the other mechanisms composing the flow, poses the basis for the formulation of theoretical frameworks able to unify all these interacting phenomena. Finally, the present work provides access to high-fidelity flow statistics of relevance for benchmark activities on bluff bodies with sharp edges.