Praise be to Allah.
There is nothing wrong with you designing a drawing or writing to be put on a T-shirt, so that if the T-shirt is sold, you will get a share of its price, and if it is not sold you will not get anything. This comes under the heading of a partnership; you contribute by providing the design, and Amazon contributes by providing and marketing the shirts. Hence it must be stipulated that your share will be a percentage of the price, not a fixed amount.
Ibn Qudaamah (may Allah have mercy on him) said: It is not permissible for any member of a partnership to stipulate that any surplus will be his, meaning that if the share of one of the partners is a fixed amount of money, or a fixed amount in addition to his share – such as stipulating that he have a percentage plus ten dirhams, the partnership becomes invalid.
Ibn al-Mundhir said: All of the scholars from whom we acquired knowledge are unanimously agreed that a profit-sharing partnership [mudaarabah] becomes invalid if one or both partners stipulate that they should receive a fixed amount of money. End quote from al-Mughni (5/2).
If the price of the T-shirt for which it is actually sold is a set amount, such as twenty dollars, and you stipulate that you should get five dollars, then there is nothing wrong with that either, because it is akin to the percentage mentioned.
Rather what is forbidden is if one of the two partners stipulates that he should get a set amount when he does not know the price for which the item will be sold, or when it is not possible to actually sell the item for the price stated.
But if the agreement is that you should receive payment for the design, whether the T-shirt is sold or not, this is selling the design, and the price for the design should be known when selling it to Amazon, and you have nothing to do with what happens after that; the company may or may not make money from the design.
With regard to entering into a partnership with the design or selling the design, the following is stipulated:
The drawings or writing should be permissible, and should not be something that could be used for sinful purposes. So you should keep away from T-shirts for women or girls, because in most cases they are used for dressing in an immodest manner (tabarruj), which is haraam.
If you design T-shirts for men or boys, then they are bought by a woman who will use them to dress in an immodest manner, there is no sin on you.
And Allah knows best.