Wash rice and drain water. It does not have to be perfect to fully drain the water out.
Add water to rice and begin to cook the rice in the water on a high flame. Once the water comes to the boiling point, reduce the heat to the lowest, and cook the rice with a tight-fitting cover for 18 minutes.
After 20 minutes of cooking from the boiling point, switch off the heat. Don’t open the cover and let the rice cook a bit more (about 5-10 minutes) in the steam that was generated inside.
Rice comes in many varieties. All the white rice varieties (Basmati, Jasmine, etc.) can use the same recipe described here.
For brown rice, the cooking time can be extended by 5 minutes. The rest of the process exactly remains the same.