The alif maqsoora (ألف مقصورة), written as ى, is a form of alif that appears at the end of some Arabic words instead of the regular alif (ا). Despite looking like a yaa without dots, it represents the same long "aa" vowel sound. Knowing when to use ى versus ا is important for correct Arabic spelling.
For verbs, the rule is based on the origin of the final letter. If the root's third letter is a واو (waw), the verb ends with regular alif: دعا (root: د-ع-و). If the root's third letter is a ياء (yaa), the verb ends with alif maqsoora: مشى (root: م-ش-ي), رمى (root: ر-م-ي). You can determine the root by conjugating the verb in a form that reveals the hidden letter.
For nouns, similar principles apply. Words with a yaa origin take alif maqsoora (فتى, مستشفى), while those with a waw origin take regular alif (عصا, رِبا). Certain word patterns always take alif maqsoora, such as the pattern فُعْلى (e.g., كُبْرى, صُغْرى) and most words ending in the long "aa" sound that have more than three letters.
For particles (حروف), the distinction is simply memorized. Common particles with alif maqsoora include: على (on), إلى (to), حتى (until), and متى (when). Common particles with regular alif include: لا (no), ما (what/not), إذا (when/if). Flashcards are an excellent tool for memorizing which particles use which form.