By doing what things a Brahmin loses his caste?
On doing what a Kshatriya loses his caste?
Generally by not following one's own duties (as per caste/Varna) and by following duties prescribed for others one looses their caste.
Manu smriti 10.97. It is better (to discharge) one’s own (appointed) duty incompletely than to perform completely that of another; for he who lives according to the law of another (caste) is instantly excluded from his own.
A Brahmin falls from his caste by doing many acts like given below:
10.92. By (selling) flesh, salt, and lac a Brahmana at once becomes an outcast; by selling milk he becomes (equal to) a Sudra in three days.
10.93. But by willingly selling in this world other (forbidden) commodities, a Brahmana assumes after seven nights the character of a Vaisya.
In times of distress a Kshatriya can adopt the modes of living that are meant for castes lower than him (Vaishya and Shudra) but he can not adopt the mode meant for Brahmins.
10.95. A Kshatriya who has fallen into distress, may subsist by all these (means); but he must never arrogantly adopt the mode of life (prescribed for his) betters.
So if Kshatriyas take up teaching or they accept gifts then they become fallen because such acts are forbidden for them.
10.75. Teaching, studying, sacrificing for himself, sacrificing for others, making gifts and receiving them are the six acts (prescribed) for a Brahmana.
10.76. But among the six acts (ordained) for him three are his means of subsistence, (viz.) sacrificing for others, teaching, and accepting gifts from pure men.
10.77. (Passing) from the Brahmana to the Kshatriya, three acts (incumbent on the former) are forbidden, (viz.) teaching, sacrificing for others, and, thirdly, the acceptance of gifts.