Question: homologous chromosomes, mitosis and meiosis

I am in high school and quite confused about mitosis and meiosis. I think I know and understand some stuff, but I am not quite sure if everything is right - and I am also kind of confused...

So in mitosis the cell divides and the result is two identical cells. To do so, the cell first replicates its DNA during interphase. The cell is diploid so has two of each type of chromosomes in the first place: II (= two chromosomes)
After the replication it has 4 chromatids: II II
But they are recognized as 2 chromosomes because they are identical. During metaphase the chromatids move to opposite poles, but they are recognized as chromosomes again. And so you have two cells with each II - and that's the two identical cells?

Now in meiosis I am confused about homologous chromosomes - and also about the role of homologous chromosomes in mitosis. Homologous chromosomes have the same genes but not necessarily the same alleles of these genes - I've learned that.
A homologous chromosome would be: IX (where the two are not identical in this case)
Now again you need to replicate these in interphase and produce a homologous pair of chromosomes right? Now I am confused, will it form IX and IX or will it form II and XX, so that in the latter case the two identical chromosomes(chromatids) of the pair of homologous chromosomes link up and are now called sister chromatids = 1 chromosomes? At any rate a homologous pair of chromosome = bivalent?
So during prophase I crossing over can occur between non sister chromosomes. Then in anaphase I the homologous chromosomes are pulled to opposite poles? So at one pole you have XI and the other also XI , but then the chromosome number is not halved, it is like in mitosis! -OR- you have at one pole XX and at the other II. In the this case you only have half the chromosome number in your resulting two cells? This case is the only scenario that halves chromosome number for me... (And in mitosis 2 you just make 4 cells, but, in case of having XX and II on the two poles, the chromosome number is not in fact halved because they are anyway the "same" chromosomes (not necessarily identical though)?)

I am confused about homologous chromosomes and they way the pair up and are replicated in mitosis and meiosis. There somewhere is the reason why mitosis duplicates and meiosis halves... and I hope you can understand what I am trying to ask, I know it is a mess.