How exactly were Madara and Obito able to control Kurama? Madara and Obito could control Kurama with their Sharingans. My question is how exactly did they do it? What is required to control this beast? Is the Sharingan enough to do that? Can they control any other beast with the same technique?

I remember Kurama once said Madara's chakra could summon it, but how was Obito able to summon and control it on his very first attempt? There's no way he could've practiced it because it was sealed inside Jinchuriki since Madara's defeat against Hashirama.

So how exactly were Madara and Obito able to control Kurama?
Okay, in order to understand the answer, you need to understand the links between the Tailed Beasts, the Uchihas and the Senjus.

The Sage of Six Paths was powerful enough to subdue the Ten-Tails, store it within himself and even split it into the nine Tailed Beasts. His two sons, Indra (whose descendants formed the Uchiha clan) and Asura (whose descendants formed the Senju clan), inherited his powerful chakra and also his power to control the Tailed Beasts.

Therefore, members of these clans who had evolved to a certain upper level like the Mangekyo Sharingan (Madara and Obito) and the Sage Mode (Hashirama Senju with his wooden dragon) also inherited the Tailed-Beast-controlling abilities which originally belonged to the Sage of Six Paths Hagoromo and was later passed on to his descendants.