The small tsu is called the “sokuon,” it’s like consonant doubling in english (like the “kk” in “takka”.)
Wikipedia has a good article on it here.
You can type it in by doubling the next consonant (よっつ = yottsu) or by typing “xtsu” (よっつ = yoxtsutsu.)
The rule for sokuon and no sokuon, I don’t know. There seems to never be sokuon before certain sounds, such as rendaku’d. But when no rendaku, only by memory that you can tell about sokuon.
And I guess you already know that ふつ、みつ、よつ、いつつ are kun readings for numbers.
In kanji compounds, when (on-reading) pronunciation of a kanji ends in ち or つ, and the following consonant is unvoiced and from the ka, sa, or ta serieses, the ち or つ are dropped and the lengthening of the following consonant is indicated by a writing small tsu (っ).
In verbal compounds when conjugation of the first verb calls for aり or き syllable, and the following consonant is not this syllable is dropped, and the lengthening of the following consonant is indicated by a writing small tsu (っ).
つ and っ are two completely different things that just happen to look similar on paper. っ is a bit like an apostrophe when something is missed out. That something may be a つ but it could be anything. This is just off the top of my head, I’m no expert.
Back in the day (before Japanese spelling got majorly overhauled in the 1940’s) they actually used to use つ to represent the sokuon, rather than っ. Imagine how fun that was. You just had to know if it was a sokuon or not. Kind of reminds you of English spelling.
In English we pronounce two consonants the same as one normally. For example past and pass only differ in the final t as far as I can tell. There are exceptions such as openness where the n is held more obviously (actually more or less said twice). English has 10 times more variations in pronunciation than Japanese.