The basic rule when you cook spaghetti and pasta in general, is to put 1 lt of water for every 100 gr past (ie for 500 gr pasta, you need 5 lt water) and 7-10 gr salt.
The technique is as follows:
Add the needed water in a saucepan, put the lid on and let the water boil. Once it starts boiling add salt and our pasta. Gently and often stir the pasta to prevent sticking, till the water starts boiling again. Let it boil, without the lid, for 7 to 9 minutes, according to package instructions. The strain our pasta in a colander (but be careful don’t pour water on your pasta). If you want, you can put 1 or 2 tablespoons of butter or margarine in the hot saucepan, add the pasta and mix it with vertical round movements, holding the saucepan from right and left.