How can online company like Amazon, eBay, Redbubble, and Teepublic, have designs that sell trademarked super hero t-shirts and not get into trouble?
For your example of items with Marvel characters on them for sale by people and companies not licensed by Marvel, Redbubble clearly states that
We ask, rather we beg, that you remember this when you are posting work on Redbubble. If you make sure that all the works you upload consist of your very own, original ideas and are not infringing on the intellectual property or publicity rights of another...
and further, Redbubble has full contact information for the submission of Notice and Takedown Reports by each real trademark owner.
There are many individuals who upload products which use unlicensed artwork in violation of trademarks, and Redbubble acknowledges this and gives recourse to the license holder to inform them so they can remove the items. It's not a perfect system, but Redbubble it seems makes every effort to help police their market. ( Teepublic has a very clear policy statement, too: https://www.teepublic.com/copyright-policy )
Many companies - such as Marvel - employ agents to regularly check such websites and issue takedown demands to the sites; the sites in turn remove the products, and in some instances, ban the individual from using the site again.
In the case of Amazon, there can be two types of products sold that use trademarked artwork and characters: items sold by legitimate businesses that have license agreements with the trademark owners and who have the products sold by Amazon itself; and items sold on the Amazon marketplace by individuals who open Amazon Marketplace accounts themselves and don't have licenses. Amazon will be sure to check the products they sell; they will have a takedown notices system for their marketplace vendors. eBay is somewhat the same way; there is a mix of individuals and businesses on eBay, but eBay doesn't operate an umbrella sell/ship by eBay, like Amazon.
It's kind of a whack-a-mole situation on the Interwebs. How much time/money does a company spend to chase down trademark infringement? Is it worth going to court for persistent violators? (These are, for the most part, civil cases, not criminal). Violators can always open a new account on sites such as Redbubble and eBay under a different name. And it starts all over again.