New main objective: Steal Madesi's Ring
Approach Madesi's stand and stand by the sliding door. Make sure you have at least a couple lockpicks and crouch. You need to make sure that you're hidden (screen above) and the eye icon doesn't appear, as otherwise you would get noticed by a guard at once. Additionally take a look around to check if any of the guards is heading this way. Items and skills boosting the Sneak skill might come in handy here, though it won't be necessary as you will be able to complete this mission even by playing with a character without experience in pickpocketing. Use the lockpick to open the lock in the door.
Additional note - If you get caught red-handed during this quest, you will traditionally have to choose if you want to pay the fine, go to prison or try to defeat the Riften Guards in direct combat.
It's not the end though, as now you will have to break into Madesi's chest. Just like before, make sure that you're hidden before making any attempts (screen above), thanks to which you won't get caught stealing. Use the picklock to open the chest and take all the items, especially Madesi's Ring.
New main objective: Plant Madesi's Ring
Return to where Brynjolf is giving a speech and stand in the spot presented on the screen above, i.e. behind Brand-Shei's back. Crouch and once again make sure that you're hidden (the game should inform you about that, instead of showing an icon of an eye). Press E to open the pickpocket menu.
Go to your own inventory, choose Apparel, mark the recently gained Madesi's Ring (screen above) and press R to put it into the pocket of the trader that you interacted with. You can close the window afterwards.
New main objective: Speak to Brynjolf
Return to Brynjolf. If you managed to steal and plant the ring, you will be rewarded with gold. If you got caught in the process, he will only tell you that he's disappointed by your actions. Curiously, you will however learn Esbern's whereabouts in both cases (screen above). Brynjolf will also offer you additional work, even if you failed his first mission. You can afterwards return to completing A Cornered Rat (resume from Finding Esbern), though you should consider watching the trader with the planted ring getting arrested.
Side quest unlocked: Taking Care of Business