Replicates: what is n?

Does n need to be the same for all groups?

No, it’s not necessary. Different groups can have different n, statistical tests can handle this fact well. The only issue is that unequal group sizes can lead to unequal spreads so you have to check the equal spreads assumption prior to ANOVA or t-test (but you always have to check this assumption, also when the group sizes are equal).

Mean or median for technical replicates?

The choice depends on the data:
If you expect outliers you choose the median
If you don’t expect outliers you can choose either statistic because they will be close together
Very often you incorporate technical replicates in your experiment because you expect inconsistency in the measurements (=outliers). In that case it makes sense to go for the median.