First, we prove a theorem on dynamics of actions of monoids by endomorphisms of semigroups. Second, we introduce algebraic structures suitable for formalizing infinitary Ramsey statements and prove a theorem that such statements are implied by the existence of appropriate homomorphisms between the algebraic structures. We make a connection between the two themes above, which allows us to prove some general Ramsey theorems for sequences. We give a new proof of the Furstenberg–Katznelson Ramsey theorem; in fact, we obtain a version of this theorem that is stronger than the original one. We answer in the negative a question of Lupini on possible extensions of Gowers’ Ramsey theorem.